UINavigationController
extension UINavigationController
-
Pushes a view controller onto the receiver’s stack and updates the display with a completion handler.
This method also calls the
pushViewController(_, animated:)
of the UINavigation controller. The difference is that it has an attached completion closure to be executed once the presentation finishes. If the presentation is animated, the completion closure is executed at the same time as the view controller transition animations. Otherwise, if the presentation is not animated, the completion closure is executed in the main queue.Declaration
Swift
public func pushViewController(_ viewController: UIViewController, animated: Bool, completion: (() -> Void)?)
Parameters
viewController
The
UIViewController
where it will be pushed intoanimated
Specify true to animate the transition or false if you do not want the transition to be animated. You might specify false if you are setting up the navigation controller at launch time.
completion
The closure to execute after the presentation finishes. This closure has no return value and takes no parameters. You may specify nil for this parameter.
-
Pops the top view controller from the navigation stack and updates the display with a completion handler.
This method also calls the
popViewController(animated:)
of the UINavigation controller. The difference is that it has an attached completion closure to be executed once the presentation finishes. If the presentation is animated, the completion closure is executed at the same time as the view controller transition animations. Otherwise, if the presentation is not animated, the completion closure is executed in the main queue.Declaration
Swift
public func popViewController(animated: Bool, completion: (() -> Void)?)
Parameters
viewController
The
UIViewController
where it will be pushed intoanimated
Specify true to animate the transition or false if you do not want the transition to be animated. You might specify false if you are setting up the navigation controller at launch time.
completion
The closure to execute after the presentation finishes. This closure has no return value and takes no parameters. You may specify nil for this parameter.