Add Image to UIAlertAction in UIAlertController

And that’s how it’s done:

let image = UIImage(named: "myImage")
var action = UIAlertAction(title: "title", style: .default, handler: nil)
action.setValue(image, forKey: "image")
alert.addAction(action)

the image property is not exposed, so there’s no guarantee of this working in future releases, but works fine as of now

Leave a Comment