So.. CALayer
KVC "extensions" handle all the weirdo's... such as..
+ (id) defaultValueForKey: (NSString*)key {
return [key isEqualToString:@"borderColor"]
? (id)cgPINK
: [super defaultValueForKey:key]; }
And Apple's Docs allude to how best to encode a struct, when they refer to the default value if you DON'T provide a value...
For example, if the value for key is a CGSize struct, the method returns a size struct containing (0.0,0.0) wrapped in an NSValue object.
However, I can't figure out how to provide normal, stinking, primitives, i.e. CGFloat
I've tried @VAL
-type NSNumber
encoding,
return ![key isEqualToString:@"lineWidth"] ?: @3;
and with no viable NSValue
methods, even a desperate attempt to cast them to id
return ![key isEqualToString:@"zPosition"] ?: (id)262453;
// lol
What's the deal? Is this just an "oh-well, ya can't" situation due to CALayer's odd-ball nature? An obvious solution I have embarrassingly overlooked? Or is it just a shady API - that refuses to document it's own shortcomings?