I\'m presenting an UIAlertViewController without any buttons, as it is supposed to just inform users that uploading is in progress. The app is supposed to upload some files
Nothing above seemed to work, but here is what works for me perfectly (xcode 10, swift 5). Enjoy!
Step 1: Place this is your viewController Class
var newQuestionAlert:UIAlertController?
Step 2: Create function to show alert
func ShowNewQuestionPopup() {
if newQuestionAlert == nil {
newQuestionAlert = UIAlertController(title: "Notice", message: "Next Question Starting", preferredStyle: .alert)
if let newQuestionAlert = newQuestionAlert {
newQuestionAlert.addAction(UIAlertAction(title: "OK", style: .default, handler: { action in
self.newQuestionAlert = nil
return
}))
self.present(newQuestionAlert, animated: true, completion: nil)
}
}
}
Step 3: Create function to dismiss alert
func autoDismiss() {
newQuestionAlert?.dismiss(animated: false, completion: nil)
newQuestionAlert = nil
}
Step 4: Call functions as needed