Wednesday, April 29, 2026
HomeiOS Developmentios - I've commented saveContext half nonetheless it will get saved in...

ios – I’ve commented saveContext half nonetheless it will get saved in coredata and is displaying the saved knowledge. It checks for e mail validation however saves in any case

[ad_1]

 let e mail  = capgEmailTextField.textual content
 func isEmailValid(str :String) -> Bool {
      let emailRegEx = "[A-Z0-9a-z._%+-]+@[A-Za-z]+.[A-Za-z]{2,4}"
      let testMail = NSPredicate(format : "SELF MATCHES %@", emailRegEx)
      return testMail.consider(with : str)
            }
            
          
  if !isEmailValid(str: e mail!){
           
     print("Electronic mail shouldn't be legitimate")
                
     let alert = UIAlertController(title: "Observe", message: "Electronic mail shouldn't be legitimate", preferredStyle: .alert)
    alert.addAction(UIAlertAction(title: "Okay", model: .cancel, handler: nil))
    current(alert, animated: true, completion: nil)
    }
  else if isEmailValid(str: e mail!){
     print("Emailvalid so m saving")
   do{
   //  AppDelegate.shared().saveContext()
       let alert = UIAlertController(title: "Observe", message: "Particulars submitted", preferredStyle: .alert)
 alert.addAction(UIAlertAction(title: "OK", model: .cancel, handler: nil))
    current(alert, animated: true, completion: nil)
                    }

It enters the if assertion and checks for the situation however saves in any case . Does not not enter else assertion. However when save context was commented it acquired saved so I do not know the way its getting saved

[ad_2]

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments