I have an app with a large number of ViewController
s. There is also a collection of functions that return UIAlertControllers
informing the user regarding events related to his account.
Here is an example of one such funtion:
func signInSuccessAlert() -> UIAlertController {
//signInSuccessAlert
let signInSuccessAlert = UIAlertController(title: "Success", message: "You have been successfully signed in!", preferredStyle: .alert)
signInSuccessAlert.addAction(UIAlertAction(title: "Okay", style: .default, handler: nil))
return signInSuccessAlert
}
My goal is to then be able to display these UIAlertController
s in one line. Like so:
present(signInSuccessAlert(), animated: true, completion: nil)
What is the best way to make these functions available only to the ViewController
s that need them? As opposed to declaring them globally.