https://kotlinlang.org logo
#compose
Title
# compose
k

Kazemihabib1996

03/13/2020, 6:49 PM
I can't understand what is
Semantics
from the documentation: for example here:
Copy code
Box(LayoutHeight.Fill + LayoutFlexible(1f), gravity = ContentGravity.BottomStart) {
            val baselineOffset = with(DensityAmbient.current) { TitleBaselineOffset.toDp() }
            AlignmentLineOffset(alignmentLine = LastBaseline, after = baselineOffset) {
                Semantics(container = true) {
                    CurrentTextStyleProvider(value = MaterialTheme.typography().h6) {
                        Row {
                            title()
                        }
                    }
                }
            }
        }
Can you please explain what is
Semantics
?
l

Leland Richardson [G]

03/13/2020, 6:53 PM
semantics is a subsystem of compose UI that allows us to kind of “mark” parts of the tree with metadata. This can be used for a lot of things: Testing, Accessibility, Developer tooling, etc.
🙏 1
k

Kazemihabib1996

03/13/2020, 7:01 PM
Thanks, Is there any example of it's usage at the moment or it's not completed yet and we're gonna see it in future?
l

Leland Richardson [G]

03/13/2020, 7:05 PM
its being used across the codebase. for instance, you can look at Toggleable, Button, Checkbox, Text, etc.
👍 1
but some of the APIs are still in flux
3 Views