Navigator
@MainActor
public class Navigator
导航管理器
-
获取最顶部的视图控制器
Declaration
Swift
@MainActor public static var topViewController: UIViewController? { get }
-
获取最顶部的导航栏控制器。如果顶部VC不含导航栏,返回nil
Declaration
Swift
@MainActor public static var topNavigationController: UINavigationController? { get }
-
获取最顶部的显示控制器
Declaration
Swift
@MainActor public static var topPresentedController: UIViewController? { get }
-
使用最顶部的导航栏控制器打开控制器
Declaration
Swift
@discardableResult @MainActor public static func push(_ viewController: UIViewController, animated: Bool = true) -> Bool
-
使用最顶部的导航栏控制器打开控制器,同时pop指定数量控制器
Declaration
Swift
@discardableResult @MainActor public static func push(_ viewController: UIViewController, pop count: Int, animated: Bool = true) -> Bool
-
使用最顶部的显示控制器弹出控制器,建议present导航栏控制器(可用来push)
Declaration
Swift
@MainActor public static func present(_ viewController: UIViewController, animated: Bool = true, completion: (@MainActor @Sendable () -> Void)? = nil)
-
使用最顶部的视图控制器打开控制器,自动判断push|present
Declaration
Swift
@MainActor public static func open(_ viewController: UIViewController, animated: Bool = true, options: NavigatorOptions = [], completion: (@MainActor @Sendable () -> Void)? = nil)
-
关闭最顶部的视图控制器,自动判断pop|dismiss,返回是否成功
Declaration
Swift
@discardableResult @MainActor public static func close(animated: Bool = true, options: NavigatorOptions = [], completion: (@MainActor @Sendable () -> Void)? = nil) -> Bool