accessibilityLabel(_:)
Adds a label to the view that describes its contents.
Declaration
nonisolated func accessibilityLabel(_ label: LocalizedStringResource) -> TextParameters
- label:
The string resource for the alternative accessibility label.
Discussion
Use this method to provide an alternative accessibility label to the text that is displayed. For example, you can give an alternate label to a navigation title:
var body: some View {
NavigationView {
ContentView()
.navigationTitle(Text("").accessibilityLabel("Inbox"))
}
}