accessibilityValue(_:isEnabled:)
Adds a textual description of the value that the tab contains.
Declaration
nonisolated func accessibilityValue(_ valueDescription: Text, isEnabled: Bool = true) -> some TabContent<Self.TabValue>
Parameters
- valueDescription:
The accessibility value to apply.
- isEnabled:
If true the accessibility value is applied; otherwise the accessibility value is unchanged.
Discussion
Use this method to describe the value represented by a tab, but only if that’s different than the tab’s label such as when an icon represent information about a tab.
var body: some View {
TabView {
Tab {
MessagesView()
} label: {
Text("Messages")
}
.badge(30)
.accessibilityValue("30 Unread")
}
}