123456789101112131415161718192021222324252627282930 |
-
- #import "RNNOptions.h"
-
- @implementation RNNOptions
-
- -(instancetype)initWithDict:(NSDictionary *)dict {
- self = [super init];
- [self mergeWith:dict];
- return self;
- }
-
- - (void)applyOn:(UIViewController *)viewController defaultOptions:(RNNOptions *)defaultOptions {
- [defaultOptions applyOn:viewController];
- [self applyOn:viewController];
- }
-
- -(void)mergeWith:(NSDictionary *)otherOptions {
- for (id key in otherOptions) {
- if ([self hasProperty:key]) {
- [self setValue:[otherOptions objectForKey:key] forKey:key];
- }
- }
- }
-
- - (BOOL)hasProperty:(NSString*)propName {
- return [self respondsToSelector:NSSelectorFromString(propName)];
- }
-
- @end
|