self?.performSegue(withIdentifier: "myview", sender: nil)
Above code do not show the navigation bar even though I use push in storyboard. Below code is shows me an error, even though the segue with correct name exist
self?.navigationController?.performSegue(withIdentifier: "myview", sender: nil)
Error
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Receiver () has no segue with identifier 'myview''
self?.navigationController?.performSegue(withIdentifier: "myview", sender: nil)
The segue is attached to a UIViewController
subclass instance and not to a UINavigationController
instance, so you cannot call it on the latter.
If you don't have a navigation bar after performing a segue, you have to make sure that you properly embedded your view controller in a navigation controller or if you added the navigation bar manually, make sure you add it to your other view controller as well in the viewWillAppear
method.