KKModel Class Reference
Inherits from | NSObject |
Conforms to | NSCoding NSCopying |
Declared in | KKModel.h |
Overview
Model object allows you to story integral data types by key (name) as mutable numbers. Useful to store automatically NSCoding/NSCopying conformant values to any node without having to subclass it.
Tasks
Other Methods
-
controller
property -
+ model
Bool Variables
Float Variables
Double Variables
Integer Variables
-
– setInt32:forKey:
-
– int32ForKey:
-
– setUnsignedInt32:forKey:
-
– unsignedInt32ForKey:
-
– setInt64:forKey:
-
– int64ForKey:
-
– setUnsignedInt64:forKey:
-
– unsignedInt64ForKey:
Arbitrary Object Variables
-
– setObject:forKey:
-
– objectForKey:
-
– valueForKeyPath:
-
– boolForKeyPath:
-
– floatForKeyPath:
-
– doubleForKeyPath:
-
– intForKeyPath:
-
– unsignedIntForKeyPath:
Getting a Mutable Number
Instance Methods
boolForKey:
Returns the value of the given type for key. Returns NO if there’s no value with this key.
- (BOOL)boolForKey:(NSString *)key
Parameters
- key
A unique string identifying the variable.
Return Value
The BOOL value for the key, or NO if there’s no variable with that key.
Declared In
KKModel.h
boolForKeyPath:
The KVC path to a value.
- (BOOL)boolForKeyPath:(NSString *)keyPath
Parameters
- keyPath
The KVC path to a value.
Return Value
The value for the path, or nil.
Declared In
KKModel.h
doubleForKey:
Returns the value of the given type for key. Returns 0 if there’s no value with this key.
- (double)doubleForKey:(NSString *)key
Parameters
- key
A unique string identifying the variable.
Return Value
The double value for the key, or 0.0 if there’s no variable with that key.
Declared In
KKModel.h
doubleForKeyPath:
The KVC path to a value.
- (double)doubleForKeyPath:(NSString *)keyPath
Parameters
- keyPath
The KVC path to a value.
Return Value
The value for the path, or nil.
Declared In
KKModel.h
floatForKey:
Returns the value of the given type for key. Returns 0 if there’s no value with this key.
- (float)floatForKey:(NSString *)key
Parameters
- key
A unique string identifying the variable.
Return Value
The float value for the key, or 0.0f if there’s no variable with that key.
Declared In
KKModel.h
floatForKeyPath:
The KVC path to a value.
- (float)floatForKeyPath:(NSString *)keyPath
Parameters
- keyPath
The KVC path to a value.
Return Value
The value for the path, or nil.
Declared In
KKModel.h
int32ForKey:
Returns the value (32-Bit) of the given type for key. Returns 0 if there’s no value with this key.
- (int32_t)int32ForKey:(NSString *)key
Parameters
- key
A unique string identifying the variable.
Return Value
The int32_t value for the key, or 0 if there’s no variable with that key.
Declared In
KKModel.h
int64ForKey:
Returns the value (64-Bit) of the given type for key. Returns 0 if there’s no value with this key.
- (int64_t)int64ForKey:(NSString *)key
Parameters
- key
A unique string identifying the variable.
Return Value
The int64_t value for the key, or 0 if there’s no variable with that key.
Declared In
KKModel.h
intForKeyPath:
The KVC path to a value.
- (int32_t)intForKeyPath:(NSString *)keyPath
Parameters
- keyPath
The KVC path to a value.
Return Value
The value for the path, or nil.
Declared In
KKModel.h
mutableNumberForKey:
Accessing the KKMutableNumber object directly allows you to change the value without having to reassign it using a setter method.
- (KKMutableNumber *)mutableNumberForKey:(NSString *)key
Parameters
- key
A unique string identifying the variable.
Return Value
The underlying KKMutableNumber object for a specific variable.
A mutable number object or nil if no variable with the given key was found.
Declared In
KKModel.h
objectForKey:
A unique string identifying the object.
- (id)objectForKey:(NSString *)key
Parameters
- key
A unique string identifying the object.
Return Value
The object for key or nil if there’s no object associated with this key.
Declared In
KKModel.h
setBool:forKey:
Set value of the given type for key. Value is mutable, it is not an NSNumber to avoid alloc/dealloc for every set.
- (void)setBool:(BOOL)boolValue forKey:(NSString *)key
Parameters
- boolValue
A boolean.
- key
A unique string to identify the variable.
Declared In
KKModel.h
setDouble:forKey:
Set value of the given type for key. Value is mutable, it is not an NSNumber to avoid alloc/dealloc for every set.
- (void)setDouble:(double)doubleValue forKey:(NSString *)key
Parameters
- doubleValue
A double.
- key
A unique string to identify the variable.
Declared In
KKModel.h
setFloat:forKey:
Set value of the given type for key. Value is mutable, it is not an NSNumber to avoid alloc/dealloc for every set.
- (void)setFloat:(float)floatValue forKey:(NSString *)key
Parameters
- floatValue
A float.
- key
A unique string to identify the variable.
Declared In
KKModel.h
setInt32:forKey:
Set value (32-Bit) of the given type for key. Value is mutable, it is not an NSNumber to avoid alloc/dealloc for every set.
- (void)setInt32:(int32_t)int32Value forKey:(NSString *)key
Parameters
- int32Value
A 32-bit integer.
- key
A unique string to identify the variable.
Declared In
KKModel.h
setInt64:forKey:
Set value (64-Bit) of the given type for key. Value is mutable, it is not an NSNumber to avoid alloc/dealloc for every set.
- (void)setInt64:(int64_t)int64Value forKey:(NSString *)key
Parameters
- int64Value
A 64-bit integer.
- key
A unique string to identify the variable.
Declared In
KKModel.h
setObject:forKey:
Assign or replace any object with the given key. If object is nil, the object for that key will be removed.
- (void)setObject:(id)object forKey:(NSString *)key
Parameters
- object
The object to store in the dictionary.
- key
A unique string to identify the object.
Declared In
KKModel.h
setUnsignedInt32:forKey:
Set value (32-Bit) of the given type for key. Value is mutable, it is not an NSNumber to avoid alloc/dealloc for every set.
- (void)setUnsignedInt32:(uint32_t)unsignedInt32Value forKey:(NSString *)key
Parameters
- unsignedInt32Value
An unsigned 32-bit integer.
- key
A unique string to identify the variable.
Declared In
KKModel.h
setUnsignedInt64:forKey:
Set value (64-Bit) of the given type for key. Value is mutable, it is not an NSNumber to avoid alloc/dealloc for every set.
- (void)setUnsignedInt64:(uint64_t)unsignedInt64Value forKey:(NSString *)key
Parameters
- unsignedInt64Value
An unsigned 64-bit integer.
- key
A unique string to identify the variable.
Declared In
KKModel.h
unsignedInt32ForKey:
Returns the value (32-Bit) of the given type for key. Returns 0 if there’s no value with this key.
- (uint32_t)unsignedInt32ForKey:(NSString *)key
Parameters
- key
A unique string identifying the variable.
Return Value
The uint32_t value for the key, or 0 if there’s no variable with that key.
Declared In
KKModel.h
unsignedInt64ForKey:
Returns the value (64-Bit) of the given type for key. Returns 0 if there’s no value with this key.
- (uint64_t)unsignedInt64ForKey:(NSString *)key
Parameters
- key
A unique string identifying the variable.
Return Value
The uint64_t value for the key, or 0 if there’s no variable with that key.
Declared In
KKModel.h