Search code examples
iosswiftuinavigationcontroller

When pass data between 2 ViewController form valide in Swift 3.1


I want to pass data between two navigation controllers. I can this with perform segue method. But I have a problem. My first navigation control has 3 textfields and a button. When click the button push other navigationcontroller. How can I perfom push to other navigationcontrol just when textfields filled. Now I click the button even if textfields empty push other nc. Tahnk you.


Solution

  • You need to implement shouldPerformSegue(withIdentifier:sender:) and return true only when it is allowed to perform the segue, otherwise return false.

    shouldPerformSegue() is called immediately prior the segue is performed.