https://kotlinlang.org logo
i

Irving

10/13/2020, 11:22 AM
Hello, I read the source code of
CircularProgressIndicator
to learn how to write a custom view.But I'm confused about the
Modifier.semantics
. I thought it's
SemanticsModifierCore
may store the properties of `CircularProgressIndicator`,but i did't see anything about
SemanticsModifierCore
in
CircularProgressIndicator
.So what does
Modifier.semantics
do for us?😢
Copy code
fun Modifier.semantics(
    mergeAllDescendants: Boolean = false, 
    properties: SemanticsPropertyReceiver.() -> Unit
): Modifier = composed {
 val id = remember { SemanticsModifierCore.generateSemanticsId() }
SemanticsModifierCore(id, mergeAllDescendants, properties)
}
a

Adam Powell

10/13/2020, 1:17 PM
Semantics publishes metadata about the UI to accessibility services and similar
👆 2
✔️ 1
a

allan.conda

10/13/2020, 1:55 PM
and similar
including testing
👍 1
i

Irving

10/14/2020, 2:02 AM
Wa!Thanks,I didn't know about accessibility services before.Now i think i've got it!