On 29 Aug 2014, at 3:48 pm, Graham Cox <graham....@bigpond.com> wrote:

> I already know that a given property of a given object is a CGSize (say)


You might wonder if I already know the type why this is even useful.

In a UI, different controls might set values independenty such as the x and y 
of a point. Each control is actually setting the same property (a point), but 
driving separate parts of it (the x and y). The UI controller is simplified if 
it can treat compound properties as if they were a single value, e.g. 
location.x, location.y, otherwise every time I set x, I have to go and fetch y 
as well and set both together (in reality that's still what I'm doing, but the 
very high level code that responds to the control doesn't need to know about it 
- it can just call my unwrapper with a keypath extended to include the field). 
Since I have hundreds of properties driven by UI this way (including multiple 
values across an array of objects), it's a big saving to genericise it.

--Graham



_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to