Index

RBThemeTracker.h

Protocols

Classes


RBThemeTracker

Manages a theme and tracks it's changes.

Properties

The delegate to receive theme tracking events.
public weak delegate RBThemeTrackerDelegate? { get }

The Class of the associated object if the object is subclass of UIView or UIViewController. It is nil otherwise.
public classification Class? { get }

The theme identifier from which to extract theme information from. Setting this will remove all previous custom overrides as well as removing the class theme (if any). If this is set to nil or if the identifier did not return a theme the default class theme (if any) will resume being used.
public identifier NSString? { get set }

Indicates that theming for the associated object should be applied automatically on materialization. Default YES. For UIView and subclass objects the didMoveToSuperView method is utilised as an indication of materialization and theming is applied when this event occurs. For UIViewController and subclass objects the viewWillAppear method is utilised as an indication materialization and theming is applied when this event occurs. In other cases this has no affect (it applies only to UIView and UIViewController). Note you may want to set this to NO in cases where a custom UIView contains subviews and the custom views theme is forwarded to the subviews examples of this include RBFormView
public shouldApplyThemingOnMaterialization Bool { get set }

Disables any further theming from being applied. This causes the processChange: from having any effect. Default NO. NB. it is the processChange: method that calls the delegates applyTheme: method when there are changings awaiting to be processed.
public disableTheming Bool { get set }

The key of the current activated state of the theme - or nil if in the normal state.
public currentStateThemeKey NSString? { get }

Functions

Initializes a new theme tracker with the given class and delegate.
@param classification : The Class of the associated object if (and only if) the object is subclass of UIView or UIViewController. Otherwise set to nil.
@param delegate : The delegate to receive theme tracking events.
@returns The initialized object.
- (nonnull instancetype)initWithClassification:(nonnull Class)classification delegate:(nonnull id<RBThemeTrackerDelegate>)delegate;

Initializes a new theme tracker with the given delegate.
@param delegate : The delegate to receive theme tracking events.
@returns The initialized object.
- (nonnull instancetype)initWithDelegate:(nonnull id<RBThemeTrackerDelegate>)delegate;

Convenience method that pushes a theme change and processes the change. Simply calls pushChanges followed by processChanges.
@param changes : The theme (that will be cast to a Dictionary of type [String : Any]) to merge.
- (void)applyChanges:(nullable id)changes;

Applies the given state theme.
@param key : The unique key of the state.
- (void)applyStateThemeWithKey:(nonnull NSString *)key;

Helper method that sets the property shouldApplyThemingOnMaterialization. on all the views that have been passed.
@param views : The views to set the property on.
@param apply : Whether or not to apply theming on materialization.
+ (void)setShouldApplyThemingOnMaterializationForViews:(nullable NSArray<UIView *> *)views apply:(BOOL)apply;