How does NSValue do its magic?
- by Paperflyer
I have an MVC application. The model has a property that is a struct NSSize. It is writable like this:
- (void)setSize:(NSSize)aSize;
The view sets this NSSize using key-value-coding. However, you can not key-value-code a struct, so I wrapped it in an NSValue-object like this:
[theView setValue:[NSValue valueWithSize:mySize]
forKey:@"theModel.size"];
To my understanding, this should not work since the accessor expects a struct and not an NSValue. But it works perfectly. Magically.
How is this possible?