class CustomSegue: UIStoryboardSegue {
override init(identifier: String?, source: UIViewController, destination: UIViewController) {
super.init(identifier: identifier, source: source, destination: destination)
}
override func perform() {
self.source.navigationController?.pushViewController(self.destination, animated: true)
}
}
In the above code, I am overriding the behavior of segue.
It should use pushViewController
only if the kind is Show (e.g.: Push) for other type it should perform the default behavior that It can.
How do I find the Kind
of segue in the subclass perform()
method?
i.e
override func perform() {
if kind==Push {
self.source.navigationController?.pushViewController(self.destination, animated: true)
} else {
super.perform()
}
}
In storyboard, select segue as custom segue and select kind as custom segue, for default behavior just select show segue (e.g. push)