• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: What's the most cocoa-ey pattern for this?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: What's the most cocoa-ey pattern for this?


  • Subject: Re: What's the most cocoa-ey pattern for this?
  • From: Michael B Johnson <email@hidden>
  • Date: Thu, 8 Jan 2009 15:34:12 -0800


On Jan 8, 2009, at 3:31 PM, Greg Titus wrote:


On Jan 8, 2009, at 3:28 PM, j o a r wrote:


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.

Except that there can be multiple active markers (they can overlap). But you could change that to:


@property (readonly) NSMutableSet *activeMarkers;

You're right - it should be a set, not an array. But would it be mutable if it's readonly? What are the correct semantics for that, actually?





And then continue to use KVO as joar is proposing...

- Greg

_______________________________________________

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


  • Follow-Ups:
    • Re: What's the most cocoa-ey pattern for this?
      • From: j o a r <email@hidden>
References: 
 >What's the most cocoa-ey pattern for this? (From: Michael B Johnson <email@hidden>)
 >Re: What's the most cocoa-ey pattern for this? (From: j o a r <email@hidden>)
 >Re: What's the most cocoa-ey pattern for this? (From: Greg Titus <email@hidden>)

  • Prev by Date: Re: What's the most cocoa-ey pattern for this?
  • Next by Date: Re: Can I call unbind: in finalize? Is it thread safe?
  • Previous by thread: Re: What's the most cocoa-ey pattern for this?
  • Next by thread: Re: What's the most cocoa-ey pattern for this?
  • Index(es):
    • Date
    • Thread