UIViewController

extension UIViewController
  • Automatically handles how to present the next view controller. If the next view controller is a UINavigationController then present it; otherwise if self has a UINavigationController then push the next controller; otherwise present the next view controller.

    Declaration

    Swift

    public func presentAutomatically(
        _ viewControllerToPresent: UIViewController,
        animated: Bool = true,
        completion: (() -> Void)? = nil
    )

    Parameters

    viewControllerToPresent

    the next view controller to present.

    animated

    this presentation has animation?

    completion

    the completion after presentation.

  • Automatically handles how to dismiss this view controller. If this view controller has a UINavigationController and its UINavigationController has more than 1 view controllers then pop this view controller; otherwise dismiss this view controller.

    Declaration

    Swift

    public func dismissAutomatically(animated: Bool = true, completion: (() -> Void)? = nil)

    Parameters

    animated

    this presentation has animation?

    completion

    the completion after dismission.