Is it allowed to add an image to UIAlertController?

I saw some solutions on the internet where they have added an UIImageView to a UIAlertController, something like this -

var imageView = UIImageView(frame: CGRect(x: 100, y: 10, width: 40, height: 40))
imageView.image = yourImage
alert.view.addSubview(imageView) 

Is this allowed? Coz Apple's documentation says the following -

"The UIAlertController class is intended to be used as-is and does not support subclassing. The view hierarchy for this class is private and must not be modified."

Believe the documentation. That note specifically addresses the sort of unsupported hack you found elsewhere online.

It would be risky to rely on or manipulate view hierarchy in the alert.

But adding TextField is a public API.

alert.addTextField(configurationHandler: {(textField) -> Void in  } )

So, you could try to add the image in the TextField (https://stackoverflow.com/questions/27903500/swift-add-icon-image-in-uitextfield) in the configuration handler.

Is it allowed to add an image to UIAlertController?
 
 
Q