there⚠ i have this error:Use of local variable 'displayMyAlertMessage' before its declaration!what i have to change??Here Editor:import UIKitclass RegisterPageViewController: UIViewController { @IBOutlet weak var repeatPasswordTextField: UITextField! @IBOutlet weak var userPassportTextField: UITextField! @IBOutlet weak var userEmailTextField: UITextField! override func viewDidLoad() { super.viewDidLoad() / } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() / } @IBAction func registerButtoTapped(sender: AnyObject) { let userEmail = userEmailTextField.text let userPassword = userPassportTextField.text let userRepeatPassword = repeatPasswordTextField.text / if userEmail.isEmpty || userPassword.isEmpty || userRepeatPassword.isEmpty { / displayMyAlertMessage("all fields are requirede");⚠ return; } / if(userPassword != userRepeatPassword) { / displayMyAlertMessage("Password do not match")⚠ return; } / NSUserDefaults.standardUserDefaults().setObject(userEmail, forKey: "user Email") NSUserDefaults.standardUserDefaults().setObject(userPassword, forKey: "userPassword") NSUserDefaults.standardUserDefaults().synchronize(); / var myAlert = UIAlertController(title: "Alert", message: "Registration is sucesfull. Thank you!", preferredStyle: UIAlertControllerStyle.Alert); let okAction = UIAlertAction(title: "Ok", style: UIAlertActionStyle.Default){ action in self.dismissViewControllerAnimated(true, completion: nil) } func displayMyAlertMessage(userMessage:String) { var myAlert = UIAlertController(title: "Alert", message: userMessage, preferredStyle: UIAlertControllerStyle.Alert); let okAction = UIAlertAction(title: "Ok", style: UIAlertActionStyle.Default, handler: nil); myAlert.addAction(okAction) self.presentViewController(myAlert, animated: true, completion: nil); }}
Selecting any option will automatically load the page