• 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
Category or Protocol? (objc newbie)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Category or Protocol? (objc newbie)


  • Subject: Category or Protocol? (objc newbie)
  • From: Rick Kitts <email@hidden>
  • Date: Mon, 18 Apr 2005 19:36:33 -0700

Hello. I'm working on a class that uses a delegate. I was looking at how Apple does this sort of thing and ran into NSXMLParser. It takes a delegate, of course, and the delegate interface is declared as follows:

// The parser's delegate is informed of events through the methods in the NSXMLParserDelegateEventAdditions category.
@interface NSObject (NSXMLParserDelegateEventAdditions)


To be honest, I'm not sure that this means. Does NSXMLParserDelegateEventAdditions
define a type that I can subclass?


Coming from Java world my inclination is to use a Protocol and do:

-(void)setDelegate:(id<MyProtocol>)delegate;

This never seems to be done in any of the Apple stuff so I'm guessing my inclination is at least idiomatically wrong but, again, I'm not sure why.

So, I guess what I'm asking is can anyone either a) explain what this stuff is trying to do or b) point me to some docs or a book that can help me understand this sort of thing? I have read the objc manual (PDF) from Apples site and I didn't see this sort of thing covered.

Many thanks in advance for any assistance,
---Rick

_______________________________________________
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: Category or Protocol? (objc newbie)
      • From: Nathan Day <email@hidden>
    • Re: Category or Protocol? (objc newbie)
      • From: Andrew White <email@hidden>
  • Prev by Date: Re: Permissions problem after NSTask application launch
  • Next by Date: Re: Strange problem when not declaring the functions in interface
  • Previous by thread: Drawing when dragging/flipping
  • Next by thread: Re: Category or Protocol? (objc newbie)
  • Index(es):
    • Date
    • Thread