• 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: NSArray operator implementing
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSArray operator implementing


  • Subject: Re: NSArray operator implementing
  • From: Steven Kramer <email@hidden>
  • Date: Fri, 26 Nov 2004 11:51:30 +0100


Hi Cornelius,

Don't think this is going to be trivial. I haven't tried and have no knowledge of prior art, but the only way I can think of to achieve this would be to override several of the KVC and KVO methods in a subclass of NSArrayController. I think you need to override (at least) addObserver:forKeyPath:options:context: and valueForKeyPath: and the implementations will be non-trivial.

Perhaps someone@apple can tell you more, I doubt you'll find this info outside of Apple.

How is this done in Java, BTW?

Good luck,

   Steven

Op 23-nov-04 om 0:59 heeft Cornelius Jaeger het volgende geschreven:

Hi All

i'm new to cocoa and i'm wondering how to extend or add operators to NSArray.
In Java it is fairly simple, not sure how to go about it in Objective-C.
what i need is a @flatten operator, that will take a keypath and flatten the arrays within.
the motivation is that i've been using bindings, thanks mmalc for the excellent examples, got me up and running presto, and it seems many of the bindings that expect BOOL or ValueTransformers need to be a fed a value from an array. I've come across some situations where i have nested arrays which won't work on the receiver.
To Use mmalcs ToDo example

_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: NSArray operator implementing
      • From: mmalcolm crawford <email@hidden>
References: 
 >NSArray operator implementing (From: Cornelius Jaeger <email@hidden>)

  • Prev by Date: NSToolbarItem as Undo
  • Next by Date: Using regex.h
  • Previous by thread: NSArray operator implementing
  • Next by thread: Re: NSArray operator implementing
  • Index(es):
    • Date
    • Thread