From 4267ef26ac3407052c7591d1ade6c2503b0982a8 Mon Sep 17 00:00:00 2001 From: Sam Williams Date: Thu, 27 Mar 2014 17:15:10 +0000 Subject: [PATCH 01/10] Add intForKey, floatForKey, boolForKey methods for extra theming support --- Source/RNThemeManager.h | 10 +++++++ Source/RNThemeManager.m | 59 ++++++++++++++++++++++++++++++++++++----- 2 files changed, 62 insertions(+), 7 deletions(-) diff --git a/Source/RNThemeManager.h b/Source/RNThemeManager.h index 2d334eb..509dcfc 100644 --- a/Source/RNThemeManager.h +++ b/Source/RNThemeManager.h @@ -23,6 +23,7 @@ extern NSString * const RNThemeManagerDidChangeThemes; // Requires 2 keys per font entry. The first key's name doesn't matter, but the size key must be suffixed with "Size" // ie: @{ @"labelFont" : @"Helvetica", @"labelFontSize" : @15 } +// If the size key is not specified, the system default will be assumed - (UIFont *)fontForKey:(NSString*)key; // Return a UIColor from a hex color stored in theme file @@ -31,6 +32,15 @@ extern NSString * const RNThemeManagerDidChangeThemes; // Return a UIImage for an image name stored in theme file - (UIImage *)imageForKey:(NSString *)key; +// Return an int stored in a theme file, using a default value if not found +- (int)intForKey:(NSString *)key defaultValue:(int)defaultValue; + +// Return an float stored in a theme file, using a default value if not found +- (float)floatForKey:(NSString *)key defaultValue:(float)defaultValue; + +// Return an bool stored in a theme file, using a default value if not found +- (BOOL)boolForKey:(NSString *)key defaultValue:(BOOL)defaultValue; + // Change the theme name, should not include .plist extension - (void)changeTheme:(NSString *)themeName; diff --git a/Source/RNThemeManager.m b/Source/RNThemeManager.m index 0d25c39..c03ad59 100644 --- a/Source/RNThemeManager.m +++ b/Source/RNThemeManager.m @@ -102,18 +102,16 @@ - (UIFont *)fontForKey:(NSString*)key { NSString *sizeKey = [key stringByAppendingString:@"Size"]; NSString *fontName = self.styles[key]; - NSString *size = self.styles[sizeKey]; + + // get the font size, using default if not supplied + CGFloat size = [self floatForKey:sizeKey defaultValue:[UIFont systemFontSize]]; while (self.styles[fontName]) { fontName = self.styles[fontName]; } - while (self.styles[size]) { - size = self.styles[size]; - } - - if (fontName && size) { - return [UIFont fontWithName:fontName size:size.floatValue]; + if (fontName) { + return [UIFont fontWithName:fontName size:size]; } return nil; } @@ -148,4 +146,51 @@ - (UIImage *)imageForKey:(NSString *)key { return nil; } +#pragma mark - Number + +- (int)intForKey:(NSString *)key defaultValue:(int)defaultValue +{ + NSString *num = self.styles[key]; + + while (self.styles[num]) { + num = self.styles[num]; + } + + if (num) { + return num.intValue; + } + + return defaultValue; +} + +- (float)floatForKey:(NSString *)key defaultValue:(float)defaultValue +{ + NSString *num = self.styles[key]; + + while (self.styles[num]) { + num = self.styles[num]; + } + + if (num) { + return num.floatValue; + } + + return defaultValue; +} + +- (BOOL)boolForKey:(NSString *)key defaultValue:(BOOL)defaultValue +{ + NSString *num = self.styles[key]; + + while (self.styles[num]) { + num = self.styles[num]; + } + + if (num) { + return num.boolValue; + } + + return defaultValue; +} + @end From 51fd22328797e500b7810e7ab64d93b9d5ea3c59 Mon Sep 17 00:00:00 2001 From: Sam Williams Date: Thu, 27 Mar 2014 17:36:42 +0000 Subject: [PATCH 02/10] Update pod spec --- RNThemeManager.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RNThemeManager.podspec b/RNThemeManager.podspec index 9b7f588..4c8c079 100644 --- a/RNThemeManager.podspec +++ b/RNThemeManager.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "RNThemeManager" - s.version = "0.1.0" + s.version = “0.2.0” s.summary = "Easily manage themes and respond to theme changes by updating views in real time." s.homepage = "https://github.com/rnystrom/RNThemeManager" s.license = 'MIT' From 43359322e08ddf24bdc0640016503469456827b0 Mon Sep 17 00:00:00 2001 From: Sam Williams Date: Thu, 27 Mar 2014 17:36:42 +0000 Subject: [PATCH 03/10] Update pod spec --- RNThemeManager.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RNThemeManager.podspec b/RNThemeManager.podspec index 9b7f588..4831784 100644 --- a/RNThemeManager.podspec +++ b/RNThemeManager.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "RNThemeManager" - s.version = "0.1.0" + s.version = “0.2” s.summary = "Easily manage themes and respond to theme changes by updating views in real time." s.homepage = "https://github.com/rnystrom/RNThemeManager" s.license = 'MIT' From afcdbd09cdc841aa4b648283b05496b6734e3b1d Mon Sep 17 00:00:00 2001 From: Sam Williams Date: Thu, 27 Mar 2014 17:45:30 +0000 Subject: [PATCH 04/10] Update RNThemeManager.podspec --- RNThemeManager.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RNThemeManager.podspec b/RNThemeManager.podspec index 4831784..7b956a0 100644 --- a/RNThemeManager.podspec +++ b/RNThemeManager.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "RNThemeManager" - s.version = “0.2” + s.version = "0.2.0" s.summary = "Easily manage themes and respond to theme changes by updating views in real time." s.homepage = "https://github.com/rnystrom/RNThemeManager" s.license = 'MIT' From 7bdbe7867bf0894d2664cc5e2b95af81a484a43c Mon Sep 17 00:00:00 2001 From: Sam Williams Date: Fri, 18 Apr 2014 19:30:02 +0100 Subject: [PATCH 05/10] Add highlightedKeyColorKey to RNThemeLabel --- Source/RNThemeLabel.h | 1 + Source/RNThemeLabel.m | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/Source/RNThemeLabel.h b/Source/RNThemeLabel.h index 82bcd4e..d29597a 100644 --- a/Source/RNThemeLabel.h +++ b/Source/RNThemeLabel.h @@ -14,6 +14,7 @@ @property (nonatomic, strong) NSString *fontKey; @property (nonatomic, strong) NSString *textColorKey; +@property (nonatomic, strong) NSString *highlightedTextColorKey; @property (nonatomic, strong) NSString *backgroundColorKey; @end diff --git a/Source/RNThemeLabel.m b/Source/RNThemeLabel.m index e34d0da..d948d4f 100644 --- a/Source/RNThemeLabel.m +++ b/Source/RNThemeLabel.m @@ -60,6 +60,10 @@ - (void)applyTheme { if (self.textColorKey && (textColor = [[RNThemeManager sharedManager] colorForKey:self.textColorKey])) { self.textColor = textColor; } + UIColor *highlightedTextColor = nil; + if (self.highlightedTextColorKey && (highlightedTextColor = [[RNThemeManager sharedManager] colorForKey:self.highlightedTextColorKey])) { + self.highlightedTextColor = highlightedTextColor; + } UIColor *backgroundColor = nil; if (self.backgroundColorKey && (backgroundColor = [[RNThemeManager sharedManager] colorForKey:self.backgroundColorKey])) { self.backgroundColor = backgroundColor; From 53c014df7976c0811dce633a57a7cf0227439c4d Mon Sep 17 00:00:00 2001 From: Sam Williams Date: Sun, 20 Apr 2014 17:55:56 +0100 Subject: [PATCH 06/10] Allow the font size key of a label to be override rather than requiring Key suffix --- Source/RNThemeLabel.h | 1 + Source/RNThemeLabel.m | 15 +++++++++++++-- Source/RNThemeManager.h | 3 +++ Source/RNThemeManager.m | 6 +++++- 4 files changed, 22 insertions(+), 3 deletions(-) diff --git a/Source/RNThemeLabel.h b/Source/RNThemeLabel.h index d29597a..72ba2cf 100644 --- a/Source/RNThemeLabel.h +++ b/Source/RNThemeLabel.h @@ -13,6 +13,7 @@ @property (nonatomic, strong) NSString *fontKey; +@property (nonatomic, strong) NSString *fontSizeKey; @property (nonatomic, strong) NSString *textColorKey; @property (nonatomic, strong) NSString *highlightedTextColorKey; @property (nonatomic, strong) NSString *backgroundColorKey; diff --git a/Source/RNThemeLabel.m b/Source/RNThemeLabel.m index d948d4f..5447adf 100644 --- a/Source/RNThemeLabel.m +++ b/Source/RNThemeLabel.m @@ -53,9 +53,20 @@ - (void)dealloc { - (void)applyTheme { UIFont *font = nil; - if (self.fontKey && (font = [[RNThemeManager sharedManager] fontForKey:self.fontKey])) { - self.font = font; + + if (self.fontKey) { + // has the fontSizeKey override be provided? + if (self.fontSizeKey) { + font = [[RNThemeManager sharedManager] fontForKey:self.fontKey sizeKey:fontSizeKey]; + } else { + font = [[RNThemeManager sharedManager] fontForKey:self.fontKey] + } + + if (font) { + self.font = font; + } } + UIColor *textColor = nil; if (self.textColorKey && (textColor = [[RNThemeManager sharedManager] colorForKey:self.textColorKey])) { self.textColor = textColor; diff --git a/Source/RNThemeManager.h b/Source/RNThemeManager.h index 509dcfc..3de128f 100644 --- a/Source/RNThemeManager.h +++ b/Source/RNThemeManager.h @@ -26,6 +26,9 @@ extern NSString * const RNThemeManagerDidChangeThemes; // If the size key is not specified, the system default will be assumed - (UIFont *)fontForKey:(NSString*)key; +// Allows the font size key to be provided separately to the font key +- (UIFont *)fontForKey:(NSString *)key sizeKey:(NSString *)sizeKey; + // Return a UIColor from a hex color stored in theme file - (UIColor *)colorForKey:(NSString *)key; diff --git a/Source/RNThemeManager.m b/Source/RNThemeManager.m index c03ad59..7e44775 100644 --- a/Source/RNThemeManager.m +++ b/Source/RNThemeManager.m @@ -100,7 +100,11 @@ - (NSDictionary *)inheritedThemeWithParentTheme:(NSString *)parentThemeName chil - (UIFont *)fontForKey:(NSString*)key { NSString *sizeKey = [key stringByAppendingString:@"Size"]; - + return [self fontForKey:key sizeKey:sizeKey]; +} + +- (UIFont *)fontForKey:(NSString *)key sizeKey:(NSString *)sizeKey +{ NSString *fontName = self.styles[key]; // get the font size, using default if not supplied From 3a98f1f61e6ee7c8ac0d8342eefaa3a5c86bbbd6 Mon Sep 17 00:00:00 2001 From: Sam Williams Date: Sun, 20 Apr 2014 18:15:18 +0100 Subject: [PATCH 07/10] Allow fontSize to be specified rather than fontSizeKey as this allows more strict theming of fonts --- Source/RNThemeLabel.h | 2 +- Source/RNThemeLabel.m | 9 +++++---- Source/RNThemeManager.h | 4 ++-- Source/RNThemeManager.m | 19 ++++++++++++++----- 4 files changed, 22 insertions(+), 12 deletions(-) diff --git a/Source/RNThemeLabel.h b/Source/RNThemeLabel.h index 72ba2cf..ab8eec2 100644 --- a/Source/RNThemeLabel.h +++ b/Source/RNThemeLabel.h @@ -13,7 +13,7 @@ @property (nonatomic, strong) NSString *fontKey; -@property (nonatomic, strong) NSString *fontSizeKey; +@property (nonatomic, strong) NSNumber fontSize; @property (nonatomic, strong) NSString *textColorKey; @property (nonatomic, strong) NSString *highlightedTextColorKey; @property (nonatomic, strong) NSString *backgroundColorKey; diff --git a/Source/RNThemeLabel.m b/Source/RNThemeLabel.m index 5447adf..aff5e66 100644 --- a/Source/RNThemeLabel.m +++ b/Source/RNThemeLabel.m @@ -55,10 +55,11 @@ - (void)applyTheme { UIFont *font = nil; if (self.fontKey) { - // has the fontSizeKey override be provided? - if (self.fontSizeKey) { - font = [[RNThemeManager sharedManager] fontForKey:self.fontKey sizeKey:fontSizeKey]; - } else { + // has the fontSize override been provided? + if (self.fontSize) { + font = [[RNThemeManager sharedManager] fontForKey:self.fontKey size:[fontSize floatValue]]; + } + else { font = [[RNThemeManager sharedManager] fontForKey:self.fontKey] } diff --git a/Source/RNThemeManager.h b/Source/RNThemeManager.h index 3de128f..14a7cd8 100644 --- a/Source/RNThemeManager.h +++ b/Source/RNThemeManager.h @@ -26,8 +26,8 @@ extern NSString * const RNThemeManagerDidChangeThemes; // If the size key is not specified, the system default will be assumed - (UIFont *)fontForKey:(NSString*)key; -// Allows the font size key to be provided separately to the font key -- (UIFont *)fontForKey:(NSString *)key sizeKey:(NSString *)sizeKey; +// Allows the font size to be provided separately rather than using the themed style +- (UIFont *)fontForKey:(NSString *)key size:(CGFloat)size; // Return a UIColor from a hex color stored in theme file - (UIColor *)colorForKey:(NSString *)key; diff --git a/Source/RNThemeManager.m b/Source/RNThemeManager.m index 7e44775..1d79ac0 100644 --- a/Source/RNThemeManager.m +++ b/Source/RNThemeManager.m @@ -100,11 +100,6 @@ - (NSDictionary *)inheritedThemeWithParentTheme:(NSString *)parentThemeName chil - (UIFont *)fontForKey:(NSString*)key { NSString *sizeKey = [key stringByAppendingString:@"Size"]; - return [self fontForKey:key sizeKey:sizeKey]; -} - -- (UIFont *)fontForKey:(NSString *)key sizeKey:(NSString *)sizeKey -{ NSString *fontName = self.styles[key]; // get the font size, using default if not supplied @@ -120,6 +115,20 @@ - (UIFont *)fontForKey:(NSString *)key sizeKey:(NSString *)sizeKey return nil; } +- (UIFont *)fontForKey:(NSString *)key size:(CGFloat)size +{ + NSString *fontName = self.styles[key]; + + while (self.styles[fontName]) { + fontName = self.styles[fontName]; + } + + if (fontName) { + return [UIFont fontWithName:fontName size:size]; + } + return nil; +} + #pragma mark - Colors - (UIColor *)colorForKey:(NSString *)key { From 99f48c0e905dd2f550a93d7beb56d7e2d0c086df Mon Sep 17 00:00:00 2001 From: Sam Williams Date: Sun, 20 Apr 2014 18:15:18 +0100 Subject: [PATCH 08/10] Allow fontSize to be specified rather than fontSizeKey as this allows more strict theming of fonts --- Source/RNThemeLabel.h | 2 +- Source/RNThemeLabel.m | 11 ++++++----- Source/RNThemeManager.h | 4 ++-- Source/RNThemeManager.m | 19 ++++++++++++++----- 4 files changed, 23 insertions(+), 13 deletions(-) diff --git a/Source/RNThemeLabel.h b/Source/RNThemeLabel.h index 72ba2cf..428dbd6 100644 --- a/Source/RNThemeLabel.h +++ b/Source/RNThemeLabel.h @@ -13,7 +13,7 @@ @property (nonatomic, strong) NSString *fontKey; -@property (nonatomic, strong) NSString *fontSizeKey; +@property (nonatomic, strong) NSNumber *fontSize; @property (nonatomic, strong) NSString *textColorKey; @property (nonatomic, strong) NSString *highlightedTextColorKey; @property (nonatomic, strong) NSString *backgroundColorKey; diff --git a/Source/RNThemeLabel.m b/Source/RNThemeLabel.m index 5447adf..5c84373 100644 --- a/Source/RNThemeLabel.m +++ b/Source/RNThemeLabel.m @@ -55,11 +55,12 @@ - (void)applyTheme { UIFont *font = nil; if (self.fontKey) { - // has the fontSizeKey override be provided? - if (self.fontSizeKey) { - font = [[RNThemeManager sharedManager] fontForKey:self.fontKey sizeKey:fontSizeKey]; - } else { - font = [[RNThemeManager sharedManager] fontForKey:self.fontKey] + // has the fontSize override been provided? + if (self.fontSize) { + font = [[RNThemeManager sharedManager] fontForKey:self.fontKey size:[self.fontSize floatValue]]; + } + else { + font = [[RNThemeManager sharedManager] fontForKey:self.fontKey]; } if (font) { diff --git a/Source/RNThemeManager.h b/Source/RNThemeManager.h index 3de128f..14a7cd8 100644 --- a/Source/RNThemeManager.h +++ b/Source/RNThemeManager.h @@ -26,8 +26,8 @@ extern NSString * const RNThemeManagerDidChangeThemes; // If the size key is not specified, the system default will be assumed - (UIFont *)fontForKey:(NSString*)key; -// Allows the font size key to be provided separately to the font key -- (UIFont *)fontForKey:(NSString *)key sizeKey:(NSString *)sizeKey; +// Allows the font size to be provided separately rather than using the themed style +- (UIFont *)fontForKey:(NSString *)key size:(CGFloat)size; // Return a UIColor from a hex color stored in theme file - (UIColor *)colorForKey:(NSString *)key; diff --git a/Source/RNThemeManager.m b/Source/RNThemeManager.m index 7e44775..1d79ac0 100644 --- a/Source/RNThemeManager.m +++ b/Source/RNThemeManager.m @@ -100,11 +100,6 @@ - (NSDictionary *)inheritedThemeWithParentTheme:(NSString *)parentThemeName chil - (UIFont *)fontForKey:(NSString*)key { NSString *sizeKey = [key stringByAppendingString:@"Size"]; - return [self fontForKey:key sizeKey:sizeKey]; -} - -- (UIFont *)fontForKey:(NSString *)key sizeKey:(NSString *)sizeKey -{ NSString *fontName = self.styles[key]; // get the font size, using default if not supplied @@ -120,6 +115,20 @@ - (UIFont *)fontForKey:(NSString *)key sizeKey:(NSString *)sizeKey return nil; } +- (UIFont *)fontForKey:(NSString *)key size:(CGFloat)size +{ + NSString *fontName = self.styles[key]; + + while (self.styles[fontName]) { + fontName = self.styles[fontName]; + } + + if (fontName) { + return [UIFont fontWithName:fontName size:size]; + } + return nil; +} + #pragma mark - Colors - (UIColor *)colorForKey:(NSString *)key { From e7574bab454f5189c0e2495d2d95a87060f43714 Mon Sep 17 00:00:00 2001 From: Sam Williams Date: Sun, 20 Apr 2014 19:49:06 +0100 Subject: [PATCH 09/10] Implement fontSize override for Button, TextField and TextView --- Source/RNThemeButton.h | 1 + Source/RNThemeButton.m | 16 ++++++++++++++-- Source/RNThemeTextField.h | 1 + Source/RNThemeTextField.m | 16 +++++++++++++--- Source/RNThemeTextView.h | 1 + Source/RNThemeTextView.m | 14 ++++++++++++-- 6 files changed, 42 insertions(+), 7 deletions(-) diff --git a/Source/RNThemeButton.h b/Source/RNThemeButton.h index dd6e1ea..a9a5827 100644 --- a/Source/RNThemeButton.h +++ b/Source/RNThemeButton.h @@ -15,6 +15,7 @@ @property (nonatomic, strong) NSString *backgroundImageKey; @property (nonatomic, strong) NSString *backgroundColorKey; @property (nonatomic, strong) NSString *fontKey; +@property (nonatomic, strong) NSNumber *fontSize; @property (nonatomic, strong) NSString *textColorKey; @property (nonatomic, strong) NSString *highlightedTextColorKey; diff --git a/Source/RNThemeButton.m b/Source/RNThemeButton.m index 8105027..6088056 100644 --- a/Source/RNThemeButton.m +++ b/Source/RNThemeButton.m @@ -53,9 +53,21 @@ - (void)dealloc { - (void)applyTheme { UIFont *font = nil; - if (self.fontKey && (font = [[RNThemeManager sharedManager] fontForKey:self.fontKey])) { - self.titleLabel.font = font; + + if (self.fontKey) { + // has the fontSize override been provided? + if (self.fontSize) { + font = [[RNThemeManager sharedManager] fontForKey:self.fontKey size:[self.fontSize floatValue]]; + } + else { + font = [[RNThemeManager sharedManager] fontForKey:self.fontKey]; + } + + if (font) { + self.font = font; + } } + UIColor *textColor = nil; if (self.textColorKey && (textColor = [[RNThemeManager sharedManager] colorForKey:self.textColorKey])) { [self setTitleColor:textColor forState:UIControlStateNormal]; diff --git a/Source/RNThemeTextField.h b/Source/RNThemeTextField.h index 1ebb3b3..a59ff74 100644 --- a/Source/RNThemeTextField.h +++ b/Source/RNThemeTextField.h @@ -13,6 +13,7 @@ @property (nonatomic, strong) NSString *fontKey; +@property (nonatomic ,strong) NSNumber *fontSize; @property (nonatomic, strong) NSString *textColorKey; @end diff --git a/Source/RNThemeTextField.m b/Source/RNThemeTextField.m index d613a1e..25b08b3 100644 --- a/Source/RNThemeTextField.m +++ b/Source/RNThemeTextField.m @@ -52,9 +52,19 @@ - (void)dealloc { } - (void)applyTheme { - UIFont *font = nil; - if (self.fontKey && (font = [[RNThemeManager sharedManager] fontForKey:self.fontKey])) { - self.font = font; + UIFont *font = nil; + if (self.fontKey) { + // has the fontSize override been provided? + if (self.fontSize) { + font = [[RNThemeManager sharedManager] fontForKey:self.fontKey size:[self.fontSize floatValue]]; + } + else { + font = [[RNThemeManager sharedManager] fontForKey:self.fontKey]; + } + + if (font) { + self.font = font; + } } UIColor *textColor = nil; if (self.textColorKey && (textColor = [[RNThemeManager sharedManager] colorForKey:self.textColorKey])) { diff --git a/Source/RNThemeTextView.h b/Source/RNThemeTextView.h index 3ecd234..ccc463b 100644 --- a/Source/RNThemeTextView.h +++ b/Source/RNThemeTextView.h @@ -13,6 +13,7 @@ @property (nonatomic, strong) NSString *fontKey; +@property (nonatomic, strong) NSNumber *fontSize; @property (nonatomic, strong) NSString *textColorKey; @end diff --git a/Source/RNThemeTextView.m b/Source/RNThemeTextView.m index 2b6b511..c5e5b97 100644 --- a/Source/RNThemeTextView.m +++ b/Source/RNThemeTextView.m @@ -53,8 +53,18 @@ - (void)dealloc { - (void)applyTheme { UIFont *font = nil; - if (self.fontKey && (font = [[RNThemeManager sharedManager] fontForKey:self.fontKey])) { - self.font = font; + if (self.fontKey) { + // has the fontSize override been provided? + if (self.fontSize) { + font = [[RNThemeManager sharedManager] fontForKey:self.fontKey size:[self.fontSize floatValue]]; + } + else { + font = [[RNThemeManager sharedManager] fontForKey:self.fontKey]; + } + + if (font) { + self.font = font; + } } UIColor *textColor = nil; if (self.textColorKey && (textColor = [[RNThemeManager sharedManager] colorForKey:self.textColorKey])) { From 9f48d3a0d797ada9ca6522006342511067dbca08 Mon Sep 17 00:00:00 2001 From: Sam Williams Date: Sun, 20 Apr 2014 22:42:33 +0100 Subject: [PATCH 10/10] Fix deprecated usage --- Source/RNThemeButton.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/RNThemeButton.m b/Source/RNThemeButton.m index 6088056..6cd964f 100644 --- a/Source/RNThemeButton.m +++ b/Source/RNThemeButton.m @@ -64,7 +64,7 @@ - (void)applyTheme { } if (font) { - self.font = font; + self.titleLabel.font = font; } }