• 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: Anyone design a 'Proxy' array?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Anyone design a 'Proxy' array?


  • Subject: Re: Anyone design a 'Proxy' array?
  • From: "John C. Randolph" <email@hidden>
  • Date: Mon, 1 Apr 2002 17:08:01 -0800

On Monday, April 1, 2002, at 04:53 PM, warren marco wrote:

On Monday, April 1, 2002, at 05:48 PM, Andrew Pinski wrote:

Do you want the selectors `makeObjectsPerformSelector:' or
`makeObjectsPerformSelector:withObject:' of NSArray?
You do not even need a NSProxy.

Thanks,
Andrew Pinski
PS this is documented at:
http://developer.apple.com/techpubs/macosx/Cocoa/Reference/Foundation/ObjC_classic/
Classes/NSArray.html

On Monday, April 1, 2002, at 07:32 , warren marco wrote:

Is it possible to create an proxy array, where methods are
transferred to all its objects, without knowing what the objects are??
It seems NSProxy's -forwardInvocation: and -
methodSignatureForSelector:
are only useful when the messages are directed to one object( or at
least objects of the same type?). Has anyone done this before? I' m not
very knowledgeable in Obj-C reflection. Does anyone have any design
ideas or code they can share?



cheers,
warren marco

haha! oops! did not see those , thats pretty much what I wanted,
thanks Andrew! I was originally looking for something like this

[someArray pop];

where all the array's objects would receive the message pop but
makeObjectsPerformSelector is good enough.

You definitely want to take a look at HOM. For example:

NSArray *someArray;

[[someArray do] somethingToDo];

The inner expression creates a 'trampoline' object, which will forward the -somethingToDo message to each of the objects in someArray.

-jcr


John C. Randolph <email@hidden> (408) 974-8819
Sr. Cocoa Software Engineer,
Apple Worldwide Developer Relations
http://developer.apple.com/cocoa/index.html
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: Anyone design a 'Proxy' array? (From: warren marco <email@hidden>)

  • Prev by Date: Why Isn't my initWithFrame method being called?
  • Next by Date: Re: NSDocument updateChangeCount : unexpected behavior
  • Previous by thread: Re: Anyone design a 'Proxy' array?
  • Next by thread: Re: Anyone design a 'Proxy' array?
  • Index(es):
    • Date
    • Thread