Is there any way to set preferred actions for alerts in SwiftUI?
You can set .cancel
roles for alert buttons, but they appear in bold and I want the other preferred action to be in bold.
I could set the preferred action to have the .cancel
role, but I don't think you're supposed to do it like that.
I haven't found a proper way yet, but I haven't played around with alerts enough to know.
Thanks for any suggestions.
It seems that, after rereading the new documentation on alert(_:ispresented:actions:message:), you can just add the .keyboardShortcut(.defaultAction)
modifier to one of the buttons in the alert's actions to make it the default action and therefore bold.