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

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -