ios - Swift segue running even though if statment is not true -


i trying stop segue running if there no text in text field

@ibaction func action(_ sender: any) {     if( email.text != ""){         emailaddress = email.text!         performsegue(withidentifier: "segue", sender: self)     }     else     {         print("enter email")     } } 

the "enter email" prints out in output still performs segue.

add segue between view controller not button view controller. see image

enter image description here

after call method on button condition

performsegue(withidentifier: "segue", sender: self) 

Comments

Popular posts from this blog

python - Selenium remoteWebDriver (& SauceLabs) Firefox moseMoveTo action exception -

html - How to custom Bootstrap grid height? -

Ansible warning on jinja2 braces on when -