1

I am trying to add the icons in action sheet of iOS app. I saw that apple has implemented such behavior in AppStore's action sheet, but hasn't provided any callback method to implement it ?

Any suggestions on how to implement it on iOS 12 Swift 4.x Xcode10.x ??

Action sheet with images.

GoodSp33d
  • 6,252
  • 4
  • 35
  • 67
Niraj Tiwari
  • 73
  • 1
  • 6
  • 1
    Possible duplicate of [Xcode Swift how to add image to UIAlertController options?](https://stackoverflow.com/questions/47885042/xcode-swift-how-to-add-image-to-uialertcontroller-options) – dahiya_boy Feb 15 '19 at 07:36
  • Possible duplicate of [Add Image to UIAlertAction in UIAlertController](https://stackoverflow.com/questions/26347085/add-image-to-uialertaction-in-uialertcontroller) – Andreas Oetjen Feb 15 '19 at 08:11

1 Answers1

8

You can add image to UIAlertAction with image key:

let image = UIImage(named: "IMAGE_NAME")
var alertAction = UIAlertAction(title: "TITLE", style: .default, handler: nil)
alertAction.setValue(image, forKey: "image")
Rocky
  • 2,903
  • 1
  • 22
  • 26