This normally happens when you are unwrapping an optional and it's value is nil
. Try putting a nil
check to navigationController
.
if let navigationcontroller: UINavigationController = navigationController { navigationcontroller.pushViewController(vc, animated: true) }