---
title: "ifSetAs"
description: "Call [block] when [property] has been provided and the value is of type [R]."
type: "function"
lastmod: "2026-09-24"
---
## API Reference

### ifSetAs

> Source set: Common

```kotlin
public inline fun <reified R : T, T> StylePropertyAccessorScope.ifSetAs(
    property: StyleProperty<T>,
    crossinline block: (R) -> Unit,
)
```

Call `block` when `property` has been provided and the value is of type `R`.

#### Parameters

| | |
| --- | --- |
| R | the value of R is required to be. |
| T | the type of the property inferred from `property` |
| property | the property to check. |
| block | called when `property` has been provided and is called with the resolved value of `property` as a parameter. |
