Last active
November 17, 2016 09:56
-
-
Save maheshgiri/76e624ddd9e83d47b853c9f189767581 to your computer and use it in GitHub Desktop.
Swift 3 Create Custom Segue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In swift3 create one segue -add identifier -add and set in segue(storyboard) custom storyboard class from cocoatouch file -In custom class override perform() | |
'override func perform() { | |
let sourceViewController = self.source | |
let destinationController = self.destination | |
let navigationController = sourceViewController.navigationController | |
// Pop to root view controller (not animated) before pushing | |
if self.identifier == "your identifier"{ | |
navigationController?.popViewController(animated: false) | |
navigationController?.pushViewController(destinationController, animated: true) | |
} | |
}' | |
-You also have to override one method in your source viewcontroller | |
' override func shouldPerformSegue(withIdentifier identifier: String, sender: Any?) -> Bool { | |
return false | |
}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment