mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-10-10 10:42:19 +00:00
New: KVC setValue:forKey: now automatically unwraps CPValue.
This corresponds to the same KVC behaviour in Cocoa and is key when decoding cibs with certain properties set to struct values (such as NSSize).
This commit is contained in:
1 parent
fe79628034
commit
bf94dd3a6e
2 files changed
+51
No files matched your search
@@ -187,6 +187,12 @@ var CPObjectAccessorsForClassKey = @"$CPObjectAccessorsForClassKey",
|
||||
|
||||
- (void)setValue:(id)aValue forKey:(CPString)aKey
|
||||
{
|
||||
// setValue:forKey: should unwrap CPValue by default. In Objective-C we would need to care about which type
|
||||
// the setter takes (or target ivar) and send [aValue rectValue], [aValue pointValue] etc, but in
|
||||
// Objective-C we can use them interchangably.
|
||||
if (aValue && aValue.isa && [aValue isKindOfClass:CPValue])
|
||||
aValue = [aValue JSObject];
|
||||
|
||||
var theClass = [self class],
|
||||
modifier = nil,
|
||||
modifiers = theClass[CPObjectModifiersForClassKey];
|
||||
|
||||
Reference in new issue
Block a user