Re: Extending KVO to scalar struct types?
Re: Extending KVO to scalar struct types?
- Subject: Re: Extending KVO to scalar struct types?
- From: Graham Cox <email@hidden>
- Date: Fri, 29 Aug 2014 15:56:27 +1000
On 29 Aug 2014, at 3:48 pm, Graham Cox <email@hidden> 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 (email@hidden)
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:
This email sent to email@hidden