ThemeManager

public class ThemeManager : NSObject

主题管理器,iOS13+可跟随系统改变

框架默认只拦截了UIView|UIViewController|UIScreen|UIImageView|UILabel类,满足条件会自动触发themeChanged;如果不满足条件或者拦截未生效,需先设置主题上下文fw.themeContext才能生效。 注意事项:iOS13以下默认不支持主题切换;如需支持,请使用fw.color相关方法

  • 单例模式

    Declaration

    Swift

    public static let shared: ThemeManager
  • 当前主题模式,默认跟随系统模式

    Declaration

    Swift

    public var mode: ThemeMode { get set }
  • iOS13切换主题模式时是否覆盖主window样式(立即生效),默认false。如果固定主题模式时颜色不正常,可尝试开启本属性

    Declaration

    Swift

    public var overrideWindow: Bool { get set }
  • 初始化方法

    Declaration

    Swift

    public override init()
  • 当前全局主题样式

    Declaration

    Swift

    public var style: ThemeStyle { get }
  • 指定traitCollection的实际显示样式,传nil时为全局样式

    Declaration

    Swift

    public func style(for traitCollection: UITraitCollection?) -> ThemeStyle