Skip to main content


Fellow #iOS #swift #swiftui developers. Do you know if the ButtonRole structure actually does anything purposeful? With #VoiceOver, I cannnot get any indication whatsoever about the button’s role, while at the AppleDeveloper documentation site: https://developer.apple.com/documentation/swiftui/buttonrole, they state that such an info should be conveyed. Is there any visual indication of the role? If so, what?
in reply to Arkadiusz Świętnicki 🇨🇳

.destructive will often use red color, that's the only visual feedback I noticed.
in reply to Arkadiusz Świętnicki 🇨🇳

As far as I know, button role influences visual appearance (red text for buttons with a 'destructive' role in views/menus/alert dialogs, or a red background if used as part of `swipeActions`), and a 'cancel' button role will re-order that button to be last when inside an alert or confirmation dialog.
Unknown parent

robb
Since Button also functions a kind of labeled function to place in e.g. Menu or Swipe Actions, I there's a lot of surface area to check – that said, this kind of semantic tagging also pays off long term.
in reply to robb

@dlx Of course I get it. I just was confused as I, as a blind developer did not see any indication whatsoever.
@robb