user30646 user30646 - 2 months ago 15
iOS Question

Why should I use destructive style

I read that Destructive style in UIAlertController should be used when action might change or delete data. This seems like a fairly simple to understand. But when I can set a label of a button and allow to define action of the button, what's the point of using distructive style? So, I assume it's gotta be something in the background that works differently than other styels. But how?


Destructive actions are a way to alert the user that the action may lead to data loss. It is meant as a visual cue by setting the text to red.

Here is how Mail uses it to differentiate between archiving messages and deleting them:

enter image description here

Ideally, you'd want to use the destructive action for actions which cannot be reversed and may cause data loss to the user.