UIWindow

@_spi(FW) extension UIWindow

Static

  • 获取当前主window,可自定义

    Declaration

    Swift

    public static var fw_mainWindow: UIWindow? { get set }
  • 获取当前主场景,可自定义

    Declaration

    Swift

    public static var fw_mainScene: UIWindowScene? { get set }

Public

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

    Declaration

    Swift

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

    Declaration

    Swift

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

    Declaration

    Swift

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

    Declaration

    Swift

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

    Declaration

    Swift

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

    Declaration

    Swift

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

    Declaration

    Swift

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

    Declaration

    Swift

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

UIWindow+ToastPlugin

  • 自定义吐司插件,未设置时自动从插件池加载

    Declaration

    Swift

    public static var fw_toastPlugin: ToastPlugin! { get set }
  • 设置吐司外间距,默认zero

    Declaration

    Swift

    public static var fw_toastInsets: UIEdgeInsets { get set }
  • 显示加载吐司,默认需手工隐藏,指定cancelBlock时点击会自动隐藏并调用之,支持String和AttributedString

    Declaration

    Swift

    public static func fw_showLoading(text: AttributedStringParameter? = nil, cancelBlock: (() -> Void)? = nil, customBlock: ((Any) -> Void)? = nil)
  • 隐藏加载吐司,可指定延迟隐藏从而实现连续的加载效果

    Declaration

    Swift

    public static func fw_hideLoading(delayed: Bool = false)
  • 获取正在显示的加载吐司视图

    Declaration

    Swift

    public static var fw_showingLoadingView: UIView? { get }
  • 是否正在显示加载吐司

    Declaration

    Swift

    public static var fw_isShowingLoading: Bool { get }
  • 显示进度条吐司,默认需手工隐藏,指定cancelBlock时点击会自动隐藏并调用之,支持String和AttributedString

    Declaration

    Swift

    public static func fw_showProgress(_ progress: CGFloat, text: AttributedStringParameter? = nil, cancelBlock: (() -> Void)? = nil, customBlock: ((Any) -> Void)? = nil)
  • 隐藏进度条吐司

    Declaration

    Swift

    public static func fw_hideProgress()
  • 获取正在显示的进度条吐司视图

    Declaration

    Swift

    public static var fw_showingProgressView: UIView? { get }
  • 是否正在显示进度条吐司

    Declaration

    Swift

    public static var fw_isShowingProgress: Bool { get }
  • 显示错误消息吐司,自动隐藏,自动隐藏完成后回调

    Declaration

    Swift

    public static func fw_showMessage(error: Error?, completion: (() -> Void)? = nil)
  • 显示指定样式消息吐司,自动隐藏,自动隐藏完成后回调,支持String和AttributedString

    Declaration

    Swift

    public static func fw_showMessage(text: AttributedStringParameter?, style: ToastStyle = .default, completion: (() -> Void)? = nil)
  • 显示指定样式消息吐司,可设置自动隐藏和允许交互,自动隐藏完成后回调,支持String和AttributedString

    Declaration

    Swift

    public static func fw_showMessage(text: AttributedStringParameter?, style: ToastStyle, autoHide: Bool, interactive: Bool, completion: (() -> Void)? = nil, customBlock: ((Any) -> Void)? = nil)
  • 隐藏消息吐司

    Declaration

    Swift

    public static func fw_hideMessage()
  • 获取正在显示的消息吐司视图

    Declaration

    Swift

    public static var fw_showingMessageView: UIView? { get }
  • 是否正在显示消息吐司

    Declaration

    Swift

    public static var fw_isShowingMessage: Bool { get }

UIWindow+UIKit

  • 获取指定索引TabBar根视图控制器(非导航控制器),找不到返回nil

    Declaration

    Swift

    public func fw_getTabBarController(index: Int) -> UIViewController?
  • 获取指定类TabBar根视图控制器(非导航控制器),找不到返回nil

    Declaration

    Swift

    public func fw_getTabBarController(of clazz: AnyClass) -> UIViewController?
  • 获取指定条件TabBar根视图控制器(非导航控制器),找不到返回nil

    Declaration

    Swift

    public func fw_getTabBarController(block: (UIViewController) -> Bool) -> UIViewController?
  • 选中并获取指定索引TabBar根视图控制器(非导航控制器),找不到返回nil

    Declaration

    Swift

    @discardableResult
    public func fw_selectTabBarController(index: Int) -> UIViewController?
  • 选中并获取指定类TabBar根视图控制器(非导航控制器),找不到返回nil

    Declaration

    Swift

    @discardableResult
    public func fw_selectTabBarController(of clazz: AnyClass) -> UIViewController?
  • 选中并获取指定条件TabBar根视图控制器(非导航控制器),找不到返回nil

    Declaration

    Swift

    @discardableResult
    public func fw_selectTabBarController(block: (UIViewController) -> Bool) -> UIViewController?