SwiftUI Accessibility: Attributes

Label

Button(action: {}, label: { Text("➡️✉️") })
.accessibility(label: Text("Send"))

Value

Slider(value: $sliderValue, in: minimumValue…maximumvalue)
.accessibility(value: Text(“\(Int(sliderValue)) out of 10”))

Hint

Button(action: {}, label: { Text(“➡️✉️”) })
.accessibility(hint: Text(“Sends your message.”))

Identifier

Button(action: {}, label: { Text(“➡️✉️”) })
.accessibility(identifier: “sendMessageButton”)

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Rob Whitaker

Rob Whitaker

225 Followers

iOS Engineer at Capital One. Author, Developing Inclusive Mobile Apps, Apress. https://amzn.to/3aNRQ6d