Manuel Manuel - 1 month ago 7x
iOS Question

How can I get the default iOS red warning color?

How can I get the default iOS red warning color that is used in

with style
without composing the color myself?


There is no API that will allow you to access the color at runtime without creating a UIAlertAction.

I know it's not exactly what you wanted, but you can do something like this:

extension UIColor {
    class func destructiveColor() -> UIColor {
        return UIColor(red: 1, green: 0.2196078431, blue: 0.137254902, alpha: 1)


let redColor = UIColor.redColor()
let destructiveColor = UIColor.destructiveColor()

Note that the two reds are slightly different:

enter image description here

Of course, this solution is imperfect because it will not automatically update if Apple tweaks the color.