Re: What's the most cocoa-ey pattern for this?
Re: What's the most cocoa-ey pattern for this?
- Subject: Re: What's the most cocoa-ey pattern for this?
- From: j o a r <email@hidden>
- Date: Thu, 8 Jan 2009 15:28:18 -0800
On Jan 8, 2009, at 2:59 PM, Michael B Johnson wrote:
This Sequence has a delegate, that would like to express interest in
the following:
(1) when the "current time" moves forward into the beginning of an
Element or Marker.
(2) when the "current time" moves backward into the end of an
Element or Marker.
(3) when the "current time" is the same as a Marker attached to a
single point in time.
With that information, we would know what Element is "active", and
what Markers might be "active".
So this is the goal: To be able to track the active element and
marker, to be notified when elements and markers are activated? It
seems to me that you're not really talking about delegation, but
rather observation (?), so how about using KVO (pseudocode &
incomplete):
@interface Sequence
@property (readonly) Element *activeElement;
@property (readonly) Element *activeMarker;
@property (readonly) Direction currentDirection;
@end
Your observers would add themselves as observers for the properties
that they are interested in, and then get notified as they changes. I
think that these three properties would be all that you need to
satisfy your #1 - #3 above.
j o a r
_______________________________________________
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