GT2/GT2-iOS/node_modules/react-native-branch/ios/NSObject+RNBranch.m

45 lines
1.1 KiB
Objective-C

//
// NSObject+RNBranch.m
// RNBranch
//
// Created by Jimmy Dee on 1/26/17.
// Copyright © 2017 Branch Metrics. All rights reserved.
//
#import <React/RCTLog.h>
#import "NSObject+RNBranch.h"
#import "RNBranchProperty.h"
@implementation NSObject(RNBranch)
+ (NSDictionary<NSString *,RNBranchProperty *> *)supportedProperties
{
return @{};
}
- (void)setSupportedPropertiesWithMap:(NSDictionary *)map
{
for (NSString *key in map.allKeys) {
RNBranchProperty *property = self.class.supportedProperties[key];
if (!property) {
RCTLogWarn(@"\"%@\" is not a supported property for %@.", key, NSStringFromClass(self.class));
continue;
}
id value = map[key];
Class type = property.type;
if (![value isKindOfClass:type]) {
RCTLogWarn(@"\"%@\" requires a value of type %@.", key, NSStringFromClass(type));
continue;
}
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Warc-performSelector-leaks"
[self performSelector:property.setterSelector withObject:value];
#pragma clang diagnostic pop
}
}
@end