Guest User

Untitled

a guest
Jul 19th, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. override func viewDidLoad() {
  2. super .viewDidLoad()
  3.  
  4. }
  5.  
  6. func showOkay (){
  7. let title = NSLocalizedString("a title", comment: "")
  8. let message = NSLocalizedString("msg", comment: "")
  9. let cansal = NSLocalizedString("cancel", comment: "")
  10. let ok = NSLocalizedString("ok", comment: "")
  11. let alertController = UIAlertController (title: title, message: message, preferredStyle: .alert)
  12.  
  13. let cancelAlertAction = UIAlertAction (title : cansal , style : .cancel) {
  14. _ in print("cancel") \ i don't understand this line . its just a print or somthing else . why i cant use print here.
  15. }
  16. let okAction = UIAlertAction(title: ok , style : .default){
  17. _ in print("ok") \ i don't understand this line. its just a print or somthing else. why i cant use print here.
  18. }
  19.  
  20. alertController.addAction(cancelAlertAction)
  21. alertController.addAction(okAction)
  22. present(alertController ,animated: true , completion: nil)
  23. }
  24. @IBAction func btnAction(_ sender: Any) {
  25. showOkay()
  26. }
Add Comment
Please, Sign In to add comment