I implemented the accepted answer from here How to display activity indicator in center of UIAlertController?
But it doesn't work, all that is displayed is the title "Creating New User" and no activity indicator is displayed. While running in the debugger I noticed that with the posted code indicator by default has its visibility set to false, so I explicitly added a line to set it to true, but it made no difference. Here then is the code from the accepted answer, with that additional line added. Why is the activity indicator not displayed?
func displaySignUpPendingAlert() -> UIAlertController
{
//create an alert controller
let pending = UIAlertController(title: "Creating New User", message: nil, preferredStyle: .alert)
let indicator = UIActivityIndicatorView(frame: pending.view.bounds)
indicator.autoresizingMask = [.flexibleWidth, .flexibleHeight]
//add the activity indicator as a subview of the alert controller's view
pending.view.addSubview(indicator)
indicator.isUserInteractionEnabled = false // required otherwise if there buttons in the UIAlertController you will not be able to press them
indicator.isHidden = false
indicator.startAnimating()
self.present(pending, animated: true, completion: nil)
return pending
}