RBTheming Class Reference

Inherits from NSObject
Declared in RBTheming.h

Overview

Provides access to the themes.

+ main

The singleton RBTheming object.

+ (nonnull RBTheming *)main

Return Value

The RBTheming object.

Discussion

The singleton RBTheming object.

Declared In

RBTheming.h

  themeSet

The set of theme assignments.

@property (nonatomic, readonly, nonnull) RBThemeSet *themeSet

Discussion

The set of theme assignments.

Declared In

RBTheming.h

  disableTheming

Causes all NEW RBThemeTracker objects to have their disableTheming match this value i.e. the view.theme/viewController.theme property. You may set this to YES to easily disable theming across your application as newly instantiated views and view controllers will have their theme.disabledTheming set to this value. Default = NO.

@property (nonatomic) BOOL disableTheming

Discussion

Causes all NEW RBThemeTracker objects to have their disableTheming match this value i.e. the view.theme/viewController.theme property. You may set this to YES to easily disable theming across your application as newly instantiated views and view controllers will have their theme.disabledTheming set to this value. Default = NO.

Declared In

RBTheming.h

  shouldAutoApplyOnFirstAppearance

Causes all NEW RBThemeTracker objects to have their shouldAutoApplyOnFirstAppearance match this value i.e. the view.theme/viewController.theme property. You may set this to YES to easily stop theming being applied when a views ‘didMoveToSuperview’ event occurs. You may set this to YES to easily stop theming being applied when a view controllers viewWillAppear event occurs. Default = YES.

@property (nonatomic) BOOL shouldAutoApplyOnFirstAppearance

Discussion

Causes all NEW RBThemeTracker objects to have their shouldAutoApplyOnFirstAppearance match this value i.e. the view.theme/viewController.theme property. You may set this to YES to easily stop theming being applied when a views ‘didMoveToSuperview’ event occurs. You may set this to YES to easily stop theming being applied when a view controllers viewWillAppear event occurs. Default = YES.

Declared In

RBTheming.h

– themeWithIdentifier:

Retrieves the theme with the given identifier.

- (nullable id)themeWithIdentifier:(nonnull NSString *)themeIdentifier

Parameters

themeIdentifier

The identifier of the theme.

Return Value

The id theme value.

Discussion

Retrieves the theme with the given identifier.

Declared In

RBTheming.h

+ enumNumberFromTheme:named:enumTypeName:defaultValue:

Reads an enumeration value from a theme dictionary.

+ (NSInteger)enumNumberFromTheme:(nonnull NSDictionary<NSString*,id> *)theme named:(nonnull NSString *)name enumTypeName:(nonnull NSString *)enumTypeName defaultValue:(int)defaultValue

Parameters

theme

The theme dictionary.

name

The key of the element in the dictionary to read.

enumTypeName

The name of the enumeration type.

defaultValue

The default value to use if a value could not be read.

Return Value

The resulting value.

Discussion

Reads an enumeration value from a theme dictionary.

Declared In

RBTheming.h

+ enumNumberFromTheme:enumTypeName:defaultValue:

Reads an enumeration value from a theme value.

+ (NSInteger)enumNumberFromTheme:(nonnull NSString *)value enumTypeName:(nonnull NSString *)enumTypeName defaultValue:(int)defaultValue

Parameters

value

The theme value.

enumTypeName

The name of the enumeration type.

defaultValue

The default value to use if a value could not be read.

Return Value

The resulting value.

Discussion

Reads an enumeration value from a theme value.

Declared In

RBTheming.h

+ numberArrayFromTheme:named:defaultValue:

Reads an array of numbers from a theme dictionary.

+ (nullable NSArray *)numberArrayFromTheme:(nonnull NSDictionary<NSString*,id> *)theme named:(nonnull NSString *)name defaultValue:(nullable NSArray *)defaultValue

Parameters

theme

The theme dictionary.

name

The key of the element in the dictionary to read.

defaultValue

The default value to use if a value could not be read.

Return Value

The resulting value.

Discussion

Reads an array of numbers from a theme dictionary.

Declared In

RBTheming.h

+ stringFromTheme:named:defaultValue:

Reads a string from a theme dictionary.

+ (nullable NSString *)stringFromTheme:(nonnull NSDictionary<NSString*,id> *)theme named:(nonnull NSString *)name defaultValue:(nullable NSString *)defaultValue

Parameters

theme

The theme dictionary.

name

The key of the element in the dictionary to read.

defaultValue

The default value to use if a value could not be read.

Return Value

The resulting value.

Discussion

Reads a string from a theme dictionary.

Declared In

RBTheming.h

+ stringFromTheme:defaultValue:

Reads a string from a theme value.

+ (nullable NSString *)stringFromTheme:(nonnull NSString *)value defaultValue:(nullable NSString *)defaultValue

Parameters

value

The theme value.

defaultValue

The default value to use if a value could not be read.

Return Value

The resulting value.

Discussion

Reads a string from a theme value.

Declared In

RBTheming.h

+ numberFromTheme:named:defaultValue:

Reads an NSNumber from a theme dictionary.

+ (nullable NSNumber *)numberFromTheme:(nonnull NSDictionary<NSString*,id> *)theme named:(nonnull NSString *)name defaultValue:(nullable NSNumber *)defaultValue

Parameters

theme

The theme dictionary.

name

The key of the element in the dictionary to read.

defaultValue

The default value to use if a value could not be read.

Return Value

The resulting value.

Discussion

Reads an NSNumber from a theme dictionary.

Declared In

RBTheming.h

+ numberFromTheme:defaultValue:

Reads an NSNumber from a theme value.

+ (nullable NSNumber *)numberFromTheme:(nonnull id)value defaultValue:(nullable NSNumber *)defaultValue

Parameters

value

The theme value.

defaultValue

The default value to use if a value could not be read.

Return Value

The resulting value.

Discussion

Reads an NSNumber from a theme value.

Declared In

RBTheming.h

+ floatFromTheme:named:defaultValue:

Reads a float from a theme dictionary.

+ (float)floatFromTheme:(nonnull NSDictionary<NSString*,id> *)theme named:(nonnull NSString *)name defaultValue:(float)defaultValue

Parameters

theme

The theme dictionary.

name

The key of the element in the dictionary to read.

defaultValue

The default value to use if a value could not be read.

Return Value

The resulting value.

Discussion

Reads a float from a theme dictionary.

Declared In

RBTheming.h

+ floatFromTheme:defaultValue:

Reads a float from a theme value.

+ (float)floatFromTheme:(nonnull id)value defaultValue:(float)defaultValue

Parameters

value

The theme value.

defaultValue

The default value to use if a value could not be read.

Return Value

The resulting value.

Discussion

Reads a float from a theme value.

Declared In

RBTheming.h

+ boolFromTheme:named:defaultValue:

Reads a boolean from a theme dictionary.

+ (BOOL)boolFromTheme:(nonnull NSDictionary<NSString*,id> *)theme named:(nonnull NSString *)name defaultValue:(BOOL)defaultValue

Parameters

theme

The theme dictionary.

name

The key of the element in the dictionary to read.

defaultValue

The default value to use if a value could not be read.

Return Value

The resulting value.

Discussion

Reads a boolean from a theme dictionary.

Declared In

RBTheming.h

+ boolFromTheme:defaultValue:

Reads a boolean from a theme value.

+ (BOOL)boolFromTheme:(nonnull id)value defaultValue:(BOOL)defaultValue

Parameters

value

The theme value.

defaultValue

The default value to use if a value could not be read.

Return Value

The resulting value.

Discussion

Reads a boolean from a theme value.

Declared In

RBTheming.h

+ integerFromTheme:named:defaultValue:

Reads an integer from a theme dictionary.

+ (NSInteger)integerFromTheme:(nonnull NSDictionary<NSString*,id> *)theme named:(nonnull NSString *)name defaultValue:(NSInteger)defaultValue

Parameters

theme

The theme dictionary.

name

The key of the element in the dictionary to read.

defaultValue

The default value to use if a value could not be read.

Return Value

The resulting value.

Discussion

Reads an integer from a theme dictionary.

Declared In

RBTheming.h

+ integerFromTheme:defaultValue:

Reads an integer from a theme value.

+ (NSInteger)integerFromTheme:(nonnull id)value defaultValue:(NSInteger)defaultValue

Parameters

value

The theme value.

defaultValue

The default value to use if a value could not be read.

Return Value

The resulting value.

Discussion

Reads an integer from a theme value.

Declared In

RBTheming.h

+ unsignedIntegerFromTheme:named:defaultValue:

Reads an unsigned integer from a theme dictionary.

+ (NSUInteger)unsignedIntegerFromTheme:(nonnull NSDictionary<NSString*,id> *)theme named:(nonnull NSString *)name defaultValue:(NSUInteger)defaultValue

Parameters

theme

The theme dictionary.

name

The key of the element in the dictionary to read.

defaultValue

The default value to use if a value could not be read.

Return Value

The resulting value.

Discussion

Reads an unsigned integer from a theme dictionary.

Declared In

RBTheming.h

+ unsignedIntegerFromTheme:defaultValue:

Reads an unsigned integer from a theme value.

+ (NSUInteger)unsignedIntegerFromTheme:(nonnull id)value defaultValue:(NSUInteger)defaultValue

Parameters

value

The theme value.

defaultValue

The default value to use if a value could not be read.

Return Value

The resulting value.

Discussion

Reads an unsigned integer from a theme value.

Declared In

RBTheming.h

+ edgeInsetsFromTheme:named:defaultValue:

Reads a UIEdgeInsets value from a theme dictionary.

+ (UIEdgeInsets)edgeInsetsFromTheme:(nonnull NSDictionary<NSString*,id> *)theme named:(nonnull NSString *)name defaultValue:(UIEdgeInsets)defaultValue

Parameters

theme

The theme dictionary.

name

The key of the element in the dictionary to read.

defaultValue

The default value to use if a value could not be read.

Return Value

The resulting value.

Discussion

Reads a UIEdgeInsets value from a theme dictionary.

Declared In

RBTheming.h

+ edgeInsetsFromTheme:defaultValue:

Reads a UIEdgeInsets value from a theme value.

+ (UIEdgeInsets)edgeInsetsFromTheme:(nonnull NSArray *)value defaultValue:(UIEdgeInsets)defaultValue

Parameters

value

The theme value.

defaultValue

The default value to use if a value could not be read.

Return Value

The resulting value.

Discussion

Reads a UIEdgeInsets value from a theme value.

Declared In

RBTheming.h

+ rectFromTheme:named:defaultValue:

Reads a CGRect value from a theme dictionary.

+ (CGRect)rectFromTheme:(nonnull NSDictionary<NSString*,id> *)theme named:(nonnull NSString *)name defaultValue:(CGRect)defaultValue

Parameters

theme

The theme dictionary.

name

The key of the element in the dictionary to read.

defaultValue

The default value to use if a value could not be read.

Return Value

The resulting value.

Discussion

Reads a CGRect value from a theme dictionary.

Declared In

RBTheming.h

+ rectFromTheme:defaultValue:

Reads a CGRect value from a theme value.

+ (CGRect)rectFromTheme:(nonnull NSArray *)value defaultValue:(CGRect)defaultValue

Parameters

value

The theme value.

defaultValue

The default value to use if a value could not be read.

Return Value

The resulting value.

Discussion

Reads a CGRect value from a theme value.

Declared In

RBTheming.h

+ sizeFromTheme:named:defaultValue:

Reads a CGSize value from a theme dictionary.

+ (CGSize)sizeFromTheme:(nonnull NSDictionary<NSString*,id> *)theme named:(nonnull NSString *)name defaultValue:(CGSize)defaultValue

Parameters

theme

The theme dictionary.

name

The key of the element in the dictionary to read.

defaultValue

The default value to use if a value could not be read.

Return Value

The resulting value.

Discussion

Reads a CGSize value from a theme dictionary.

Declared In

RBTheming.h

+ sizeFromTheme:defaultValue:

Reads a CGSize value from a theme value.

+ (CGSize)sizeFromTheme:(nonnull NSArray *)value defaultValue:(CGSize)defaultValue

Parameters

value

The theme value.

defaultValue

The default value to use if a value could not be read.

Return Value

The resulting value.

Discussion

Reads a CGSize value from a theme value.

Declared In

RBTheming.h

+ fontFromTheme:named:defaultValue:

Reads a UIFont from a theme dictionary.

+ (nullable UIFont *)fontFromTheme:(nonnull NSDictionary<NSString*,id> *)theme named:(nonnull NSString *)name defaultValue:(nullable UIFont *)defaultValue

Parameters

theme

The theme dictionary.

name

The key of the element in the dictionary to read.

defaultValue

The default value to use if a value could not be read.

Return Value

The resulting value.

Discussion

Reads a UIFont from a theme dictionary.

Declared In

RBTheming.h

+ fontFromTheme:defaultValue:

Reads a UIFont from a theme value.

+ (nullable UIFont *)fontFromTheme:(nonnull NSDictionary<NSString*,id> *)theme defaultValue:(nullable UIFont *)defaultValue

Parameters

theme

The theme value.

defaultValue

The default value to use if a value could not be read.

Return Value

The resulting value.

Discussion

Reads a UIFont from a theme value.

Declared In

RBTheming.h

+ colorFromTheme:named:defaultValue:

Reads a UIColor from a theme dictionary.

+ (nullable UIColor *)colorFromTheme:(nonnull NSDictionary<NSString*,id> *)theme named:(nonnull NSString *)name defaultValue:(nullable UIColor *)defaultValue

Parameters

theme

The theme dictionary.

name

The key of the element in the dictionary to read.

defaultValue

The default value to use if a value could not be read.

Return Value

The resulting value.

Discussion

Reads a UIColor from a theme dictionary.

Declared In

RBTheming.h

+ colorFromTheme:defaultValue:

Reads a UIColor from a theme value.

+ (nullable UIColor *)colorFromTheme:(nonnull NSString *)value defaultValue:(nullable UIColor *)defaultValue

Parameters

value

The theme value.

defaultValue

The default value to use if a value could not be read.

Return Value

The resulting value.

Discussion

Reads a UIColor from a theme value.

Declared In

RBTheming.h

+ imageFromTheme:named:defaultValue:

Reads an image from a theme dictionary.

+ (nullable UIImage *)imageFromTheme:(nonnull NSDictionary<NSString*,id> *)theme named:(nonnull NSString *)name defaultValue:(nullable UIImage *)defaultValue

Parameters

theme

The theme dictionary.

name

The key of the element in the dictionary to read.

defaultValue

The default value to use if a value could not be read.

Return Value

The resulting value.

Discussion

Reads an image from a theme dictionary.

Declared In

RBTheming.h

+ imageFromTheme:defaultValue:

Reads an image from a theme value.

+ (nullable UIImage *)imageFromTheme:(nonnull NSString *)value defaultValue:(nullable UIImage *)defaultValue

Parameters

value

The theme value.

defaultValue

The default value to use if a value could not be read.

Return Value

The resulting value.

Discussion

Reads an image from a theme value.

Declared In

RBTheming.h

+ textStyleFromTheme:named:defaultValue:

Reads a text style name from a theme dictionary.

+ (nullable NSString *)textStyleFromTheme:(nonnull NSDictionary<NSString*,id> *)theme named:(nonnull NSString *)name defaultValue:(nullable NSString *)defaultValue

Parameters

theme

The theme dictionary.

name

The key of the element in the dictionary to read.

defaultValue

The default value to use if a value could not be read.

Return Value

The resulting value.

Discussion

Reads a text style name from a theme dictionary.

Declared In

RBTheming.h

+ textStyleFromTheme:defaultValue:

Reads a text style name from a theme value.

+ (nullable NSString *)textStyleFromTheme:(nonnull NSString *)value defaultValue:(nullable NSString *)defaultValue

Parameters

value

The theme value.

defaultValue

The default value to use if a value could not be read.

Return Value

The resulting value.

Discussion

Reads a text style name from a theme value.

Declared In

RBTheming.h