NSObject(FWTheme)

@interface NSObject (FWTheme) <FWThemeObserver>

/// 订阅主题通知并指定主题上下文(如vc|view),非UITraitEnvironment等需指定后才能响应系统主题
@property (nullable, nonatomic, weak) id<UITraitEnvironment> fw_themeContext NS_REFINED_FOR_SWIFT;

/// 添加iOS13主题改变通知回调,返回订阅唯一标志,需订阅后才生效
- (nullable NSString *)fw_addThemeListener:(void (^)(FWThemeStyle style))listener NS_REFINED_FOR_SWIFT;

/// iOS13根据订阅唯一标志移除主题通知回调
- (void)fw_removeThemeListener:(nullable NSString *)identifier NS_REFINED_FOR_SWIFT;

/// iOS13移除所有主题通知回调,一般用于cell重用
- (void)fw_removeAllThemeListeners NS_REFINED_FOR_SWIFT;

/// iOS13主题改变包装器钩子,如果父类有重写,记得调用super,需订阅后才生效
- (void)fw_themeChanged:(FWThemeStyle)style NS_REFINED_FOR_SWIFT;

@end

Undocumented

  • 订阅主题通知并指定主题上下文(如vc|view),非UITraitEnvironment等需指定后才能响应系统主题

    Declaration

    Objective-C

    @property (nonatomic, weak, nullable) id<UITraitEnvironment> fw_themeContext;
  • 添加iOS13主题改变通知回调,返回订阅唯一标志,需订阅后才生效

    Declaration

    Objective-C

    - (nullable NSString *)fw_addThemeListener:
        (nonnull void (^)(FWThemeStyle))listener;
  • iOS13根据订阅唯一标志移除主题通知回调

    Declaration

    Objective-C

    - (void)fw_removeThemeListener:(nullable NSString *)identifier;
  • iOS13移除所有主题通知回调,一般用于cell重用

    Declaration

    Objective-C

    - (void)fw_removeAllThemeListeners;
  • iOS13主题改变包装器钩子,如果父类有重写,记得调用super,需订阅后才生效

    Declaration

    Objective-C

    - (void)fw_themeChanged:(FWThemeStyle)style;