KKClassVarSetter Class Reference
Inherits from | NSObject |
Declared in | KKClassVarSetter.h |
Overview
Utility class that allows to set an object’s ivars from a NSDictionary. The dictionary must have strings as keys (the ivar names) and KKMutableNumber or NSString types as values.
Instance Methods
initWithClass:
Initialize ivar setter with a class.
- (id)initWithClass:(Class)klass
Parameters
- class
The class on which to set variables.
Return Value
A new instance of KKClassVarSetter
Declared In
KKClassVarSetter.h
setIvarsWithDictionary:mapping:target:
nd
- (void)setIvarsWithDictionary:(NSDictionary *)ivarsDictionary mapping:(NSDictionary *)mapping target:(id)target
Declared In
KKClassVarSetter.h
setIvarsWithDictionary:target:
Sets the ivars in the target if their key in the dictionary matches the ivar name and type. The dictionary must have NSString as keys and either NSString or KKMutableNumber as values. The target’s class must match the class the KKClassVarSetter object was initialized with.
- (void)setIvarsWithDictionary:(NSDictionary *)ivarsDictionary target:(id)target
Parameters
- ivarsDictionary
A NSString keyed dictionary with values for ivars. The keys must begin with _ which is the standard prefix of ivar names.
- target
The target to which to set the ivar values.
Declared In
KKClassVarSetter.h
setPropertiesWithDictionary:mapping:target:
nd
- (void)setPropertiesWithDictionary:(NSDictionary *)propertiesDictionary mapping:(NSDictionary *)mapping target:(id)target
Declared In
KKClassVarSetter.h
setPropertiesWithDictionary:target:
Calls property setters in the target by using setValue:forKey: (KVC). The dictionary must have NSString as keys and either NSString or KKMutableNumber as values which must match or be convertible to the property’s type. The target’s class must match the class the KKClassVarSetter object was initialized with.
- (void)setPropertiesWithDictionary:(NSDictionary *)propertiesDictionary target:(id)target
Parameters
- propertiesDictionary
A NSString keyed dictionary with values for properties. The keys must match existing properties' names for the given class.
- target
The target to which to set the properties.
Declared In
KKClassVarSetter.h