UIAlertController background color

I have been using the UIAlertController. I would like to change the background color on just the alert messagebox.

Has anyone accomplished this with the UIAlertController?

Here is an example in Swift of what I would like to be able to do:

func testAlert(){
    let alert = UIAlertController(title: "Let's See ..",message: "It Works!", preferredStyle: .alert)
    let dismissAction = UIAlertAction(title: "Dismiss", style: .default, handler: nil)

    // Accessing alert view backgroundColor :
    alert.view.subviews.first?.subviews.first?.subviews.first?.backgroundColor = UIColor.green

    // Accessing buttons tintcolor :
    alert.view.tintColor = UIColor.white

    alert.addAction(dismissAction)
    present(alert, animated: true, completion:  nil)
}



That’s not an official API.
Your app might be rejected by App Store review for doing such a thing, and it could break in a future iOS update.

Definitely not recommended.
Make your own alert using containers instead.

Enterprise app that does not go through App Store review.

Didn’t realize we now could create Container Controls in IOS. Thanks for the suggestion!