RBThemeTracker Class Reference

Inherits from RBPropertyListTracker : NSObject
Declared in RBThemeTracker.h

Overview

Manages a theme and tracks it’s changes.

  delegate

The delegate to receive theme tracking events.

@property (nonatomic, readonly, weak, nullable) id<RBThemeTrackerDelegate> delegate

Declared In

RBThemeTracker.h

  classification

The Class of the associated object if the object is subclass of UIView or UIViewController. It is nil otherwise.

@property (nonatomic, readonly, nullable) Class classification

Declared In

RBThemeTracker.h

  identifier

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.

@property (nonatomic, nullable) NSString *identifier

Declared In

RBThemeTracker.h

  shouldApplyThemingOnMaterialization

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).

@property (nonatomic) BOOL shouldApplyThemingOnMaterialization

Discussion

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 RBManagedFormView

Declared In

RBThemeTracker.h

  disableTheming

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.

@property (nonatomic) BOOL disableTheming

Declared In

RBThemeTracker.h

– initWithClassification:delegate:

Initializes a new theme tracker with the given class and delegate.

- (nonnull instancetype)initWithClassification:(nonnull Class)classification delegate:(nonnull id<RBThemeTrackerDelegate>)delegate

Parameters

classification

The Class of the associated object if (and only if) the object is subclass of UIView or UIViewController. Otherwise set to nil.

delegate

The delegate to receive theme tracking events.

Return Value

The initialized object.

Declared In

RBThemeTracker.h

– initWithDelegate:

Initializes a new theme tracker with the given delegate.

- (nonnull instancetype)initWithDelegate:(nonnull id<RBThemeTrackerDelegate>)delegate

Parameters

delegate

The delegate to receive theme tracking events.

Return Value

The initialized object.

Declared In

RBThemeTracker.h

– applyChanges:

Convenience method that pushes a theme change and processes the change. Simply calls pushChanges followed by processChanges.

- (void)applyChanges:(nullable NSDictionary<NSString*,id> *)changes

Parameters

changes

The theme to merge.

Declared In

RBThemeTracker.h

– apply

Manually applies the full theme (using the value of the currentStateThemeKey if available).

- (void)apply

Declared In

RBThemeTracker.h

– reset

Resets theming removing all theming values and then reloads as normal via class theme and then via identifier. Note any custom theming values that may have been previously applied will of course no longer be set.

- (void)reset

Declared In

RBThemeTracker.h

– clear

Removes all theming values that may currently be present.

- (void)clear

Declared In

RBThemeTracker.h

  currentStateThemeKey

The key of the current activated state of the theme - or nil if in the normal state.

@property (nonatomic, readonly, nullable) NSString *currentStateThemeKey

Declared In

RBThemeTracker.h

– applyNormalStateTheme

Applies the normal state of the theme.

- (void)applyNormalStateTheme

Declared In

RBThemeTracker.h

– applyCurrentState

Re-applies the current state of the theme.

- (void)applyCurrentState

Declared In

RBThemeTracker.h

– applyStateThemeWithKey:

Applies the given state theme.

- (void)applyStateThemeWithKey:(nonnull NSString *)key

Parameters

key

The unique key of the state.

Declared In

RBThemeTracker.h

+ setShouldApplyThemingOnMaterializationForViews:apply:

Helper method that sets the property shouldApplyThemingOnMaterialization. on all the views that have been passed.

+ (void)setShouldApplyThemingOnMaterializationForViews:(nullable NSArray<UIView*> *)views apply:(BOOL)apply

Parameters

views

The views to set the property on.

apply

Whether or not to apply theming on materialization.

Declared In

RBThemeTracker.h