Interface

SemanticsPropertyProvider

Read-only view of semantics properties.

Source set: Common
public interface SemanticsPropertyProvider

Read-only view of semantics properties.

SemanticsConfiguration implements this interface. SemanticsNode.unmergedConfig and SemanticsNode.mergedConfig return it so that hosts can read semantics without mutating them.

Properties

accessibilityExtraKeys

Source set: Common
public val accessibilityExtraKeys: Set<SemanticsPropertyKey<*>>

Keys in this provider whose SemanticsPropertyKey.accessibilityExtraKey is non-null.

Hosts expose these values as accessibility extras. Returns an empty set if there are none.

isMergingSemanticsOfDescendants

Source set: Common
public val isMergingSemanticsOfDescendants: Boolean

Whether this configuration declares that it merges the semantics of its descendants (Modifier.semantics(mergeDescendants = true)).

This is the declared value only. SemanticsNode.isMergingSemanticsOfDescendants is true only when this value is true and the node was created with SemanticsNode.mergingEnabled.

Functions

get

Source set: Common
public operator fun <T> get(key: SemanticsPropertyKey<T>): T

Returns the value for key, or throws IllegalStateException if not set.

Parameters

key Property key to retrieve.

Return

Value associated with key.

Throws: IllegalStateException

if key is not present.

getOrElse

Source set: Common
public fun <T> getOrElse(key: SemanticsPropertyKey<T>, defaultValue: () -> T): T

Returns the value for key, or runs defaultValue if not set.

Parameters

key Property key to retrieve.
defaultValue Fallback supplier run when key is not present.

Return

Value associated with key, or the result of defaultValue.

getOrElseNullable

Source set: Common
public fun <T> getOrElseNullable(key: SemanticsPropertyKey<T>, defaultValue: () -> T?): T?

Returns the value for key, or runs defaultValue if not set.

Parameters

key Property key to retrieve.
defaultValue Fallback supplier run when key is not present.

Return

Value associated with key, or the result of defaultValue.

contains

Source set: Common
public operator fun <T> contains(key: SemanticsPropertyKey<T>): Boolean

Returns whether key is present in this provider.

Parameters

key Property key to check.

Return

true if key is present, false otherwise.

forEachProperty

Source set: Common
public fun forEachProperty(action: (key: SemanticsPropertyKey<*>, value: Any?) -> Unit)

Invokes action for each property key and value in this provider.

Parameters

action Callback invoked with each SemanticsPropertyKey and its associated value.

anyProperty

Source set: Common
public fun anyProperty(
        predicate: (key: SemanticsPropertyKey<*>, value: Any?) -> Boolean
    ): Boolean

Returns true if at least one property in this provider matches predicate. Stops at the first match.

Parameters

predicate Predicate invoked with each SemanticsPropertyKey and its associated value.
Jetpack Compose beyond MaterialFree components, screens and templates for apps that don’t look like Google’s. Copy them into your app, or let your coding agent add them.Browse for free

Content updated: