NSAlert destructive button
As Big Sur came onto our Macs I noticed that destructive button's text in NSAlert
controller are colored in red as shown in picture.
I wasn't able to find a way to bring this feature in my app.
Using the standard addButton(withTitle:)
method we haven't any way to set its intent (such as default, cancel or destructive).
Can you give me any hint?
Thanks
Solution 1:
Set the property hasDestructiveAction
of the button to true
. This property is new in Big Sur.
Source: AppKit Release Notes for macOS Big Sur 11