Navigator

public class Navigator : NSObject

导航管理器

  • 获取最顶部的视图控制器

    Declaration

    Swift

    public static var topViewController: UIViewController? { get }
  • 获取最顶部的导航栏控制器。如果顶部VC不含导航栏,返回nil

    Declaration

    Swift

    public static var topNavigationController: UINavigationController? { get }
  • 获取最顶部的显示控制器

    Declaration

    Swift

    public static var topPresentedController: UIViewController? { get }
  • 使用最顶部的导航栏控制器打开控制器

    Declaration

    Swift

    @discardableResult
    public static func push(_ viewController: UIViewController, animated: Bool = true) -> Bool
  • 使用最顶部的导航栏控制器打开控制器,同时pop指定数量控制器

    Declaration

    Swift

    @discardableResult
    public static func push(_ viewController: UIViewController, pop count: Int, animated: Bool = true) -> Bool
  • 使用最顶部的显示控制器弹出控制器,建议present导航栏控制器(可用来push)

    Declaration

    Swift

    public static func present(_ viewController: UIViewController, animated: Bool = true, completion: (() -> Void)? = nil)
  • 使用最顶部的视图控制器打开控制器,自动判断push|present

    Declaration

    Swift

    public static func open(_ viewController: UIViewController, animated: Bool = true, options: NavigatorOptions = [], completion: (() -> Void)? = nil)
  • 关闭最顶部的视图控制器,自动判断pop|dismiss,返回是否成功

    Declaration

    Swift

    @discardableResult
    public static func close(animated: Bool = true, options: NavigatorOptions = [], completion: (() -> Void)? = nil) -> Bool