As you can see, my navigation controller is embedded in the root view controller. In this view controller, I have a subview, and at one point, I push the popover onto the view controller. For some reason, I cannot use navigationController.popViewController(animated: true)
because the navigation controller is nil(by printing the value to the debug console). How can I fix this?
Use dismiss(animated flag: Bool, completion: (() -> Void)? = nil)
. Call it from your popover view controller:
self.dismiss(animated: true)