Re: adding something to a setter
Re: adding something to a setter
- Subject: Re: adding something to a setter
- From: Kyle Sluder <email@hidden>
- Date: Thu, 06 Oct 2011 13:12:44 -0700
On Thu, Oct 6, 2011 at 12:33 PM, Quincey Morris
<email@hidden> wrote:
> By all means use self-observation if that solves your problem. There's absolutely nothing wrong with it, so any negative feelings you might have are just another perceptual problem. Note, however, that because the observer mechanism is so clunky, you're going to write *more* lines of code this way than in overriding the setter, yet all it buys you is the unwanted/unnecessary "atomic" implementation.
Not necessarily. If you expect subclasses to add properties that
require poking -setNeedsDisplay:, or you just have a lot of them, it's
probably worth adding a class method like +keyPathsRequiringRedisplay,
register as self-observers for all these keypaths, and provide a
really simple implementation of -observeValueForKeyPath:… that calls
[self setNeedsDisplay].
As far as "unwanted/unnecessary 'atomic'" is concerned, don't get me
started. That design mistake is going to haunt us forever.
--Kyle Sluder
_______________________________________________
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