Guest User

Untitled

a guest
Dec 12th, 2017
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. class UIExtension: UIViewController {
  2.  
  3. func prepareAlert(title: String, message: String) -> UIAlertController {
  4. let alert = UIAlertController(title: title, message: message, preferredStyle: UIAlertControllerStyle.alert)
  5. alert.addAction(UIAlertAction(title: "Ok", style: .default, handler: nil))
  6. return alert
  7. }
  8.  
  9. }
  10.  
  11. class FirstViewController: UIExtension {
  12.  
  13. //somewhere inside used the following
  14. present(prepareAlert(title: "Error Validation", message: "invalid fields"), animated: true, completion: nil)
  15.  
  16. }
Add Comment
Please, Sign In to add comment