Manuel Manuel - 1 year ago 72
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?

Answer Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download