Skip to content
This repository was archived by the owner on Nov 2, 2020. It is now read-only.

Commit eab620c

Browse files
committed
Had to specify the property explicitly to bind UIColor. Now we use defaultValue property to get the tweak's type.
1 parent 94da040 commit eab620c

File tree

4 files changed

+5
-6
lines changed

4 files changed

+5
-6
lines changed

FBTweak/_FBTweakCollectionViewController.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
129129
} else if ([tweak.possibleValues isKindOfClass:[NSArray class]]) {
130130
_FBTweakArrayViewController *vc = [[_FBTweakArrayViewController alloc] initWithTweak:tweak];
131131
[self.navigationController pushViewController:vc animated:YES];
132-
} else if ([tweak.possibleValues isKindOfClass:[UIColor class]]) {
132+
} else if ([tweak.defaultValue isKindOfClass:[UIColor class]]) {
133133
_FBTweakColorViewController *vc = [[_FBTweakColorViewController alloc] initWithTweak:tweak];
134134
[self.navigationController pushViewController:vc animated:YES];
135135
}

FBTweak/_FBTweakColorViewController.m

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ @implementation _FBTweakColorViewController {
3131

3232
- (instancetype)initWithTweak:(FBTweak*)tweak
3333
{
34-
NSParameterAssert(tweak != nil);
35-
NSParameterAssert([tweak.possibleValues isKindOfClass:[UIColor class]]);
34+
NSParameterAssert([tweak.defaultValue isKindOfClass:[UIColor class]]);
3635
self = [super init];
3736
if (self) {
3837
_tweak = tweak;

FBTweak/_FBTweakTableViewCell.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ - (void)setTweak:(FBTweak *)tweak
127127
mode = _FBTweakTableViewCellModeDictionary;
128128
} else if ([tweak.possibleValues isKindOfClass:[NSArray class]]) {
129129
mode = _FBTweakTableViewCellModeArray;
130-
} else if ([tweak.possibleValues isKindOfClass:[UIColor class]]) {
130+
} else if ([value isKindOfClass:[UIColor class]]) {
131131
mode = _FBTweakTableViewCellModeColor;
132132
} else if ([value isKindOfClass:[NSString class]]) {
133133
mode = _FBTweakTableViewCellModeString;

FBTweakExample/FBAppDelegate.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,11 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
5959
_label.textColor = [UIColor blackColor];
6060
_label.font = [UIFont systemFontOfSize:FBTweakValue(@"Content", @"Text", @"Size", 60.0)];
6161
FBTweakBind(_label, text, @"Content", @"Text", @"String", @"Tweaks");
62-
FBTweakBind(_label, textColor, @"Content", @"Text", @"Color", [UIColor redColor], [UIColor redColor]);
62+
FBTweakBind(_label, textColor, @"Content", @"Text", @"Color", [UIColor redColor]);
6363
FBTweakBind(_label, alpha, @"Content", @"Text", @"Alpha", 0.5, 0.0, 1.0);
6464
[_rootViewController.view addSubview:_label];
6565

66-
FBTweakBind(_rootViewController.view, backgroundColor, @"Content", @"Background", @"Color", [UIColor whiteColor], [UIColor whiteColor]);
66+
FBTweakBind(_rootViewController.view, backgroundColor, @"Content", @"Background", @"Color", [UIColor whiteColor]);
6767

6868
UITapGestureRecognizer *tapRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(labelTapped)];
6969
[_label addGestureRecognizer:tapRecognizer];

0 commit comments

Comments
 (0)