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

NSArray operator implementing


  • Subject: NSArray operator implementing
  • From: Cornelius Jaeger <email@hidden>
  • Date: Tue, 23 Nov 2004 00:59:59 +0100

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


we have an array of Todo's with a Category that contains a priority:
Todos
	0 : CategoryA.priority (1)
	1 : CategoryB.priority (2)
	2 : CategoryC.priority (3)

when we use this with the value transformer it will work fine because in mmalcs example it expects a number (priority).
what if we had a User that had a list of Todo's and we have an NSArrayController of Users.


Users
	0 : mmalc
		Todos
			0: CategoryA.priority (1)
	1 : scott
		Todos
			0: CategoryB.priority (3)

if we sent this keypath to the value transformer it wouldn't work becuase it would get an array of numbers rather than just a number

so we'd have to use a keypath like

@"email@hiddenity"

so how do install my own operators in NSArray in Objective-C


sorry for the wordiness, any pointers and reading assignments welcome

thx

cornelius



_______________________________________________
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: Steven Kramer <email@hidden>
  • Prev by Date: Re: Applescript
  • Next by Date: Re: Re: Using mouseEntered and mouseExited
  • Previous by thread: Re: Calculate height of text in a text field
  • Next by thread: Re: NSArray operator implementing
  • Index(es):
    • Date
    • Thread