• 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: Creating Interface
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Creating Interface


  • Subject: Re: Creating Interface
  • From: Phil <email@hidden>
  • Date: Fri, 29 Aug 2008 01:03:33 +1200

On Fri, Aug 29, 2008 at 12:32 AM, Jean-Daniel Dupas
<email@hidden> wrote:
> When you use the id<protocol> syntaxt, the compiler assume your object only
> implements the method declared in your protocol.
> If you want to use some other function, you have to use an object type that
> declare thoses functions, for example in your case, NSObject.
>

However, NSObject is both a class and a protocol. Although most
classes inherit from NSObject, this is not always the case (for
example, using DO, where objects inherit from the NSProxy root class).

It's preferrable if your protocol incorporates the NSObject protocol
as well, which enforces all implementors to also conform to the
NSObject protocol (and you take an id<MyProtocol>)---because you don't
actually care if you have an NSObject subclass, just that whatever
you've got behaves like an NSObject.

Phil
_______________________________________________

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: Creating Interface
      • From: Roland King <email@hidden>
References: 
 >Creating Interface (From: "Christian Giordano" <email@hidden>)
 >Re: Creating Interface (From: Matthias Schonder <email@hidden>)
 >Re: Creating Interface (From: "Christian Giordano" <email@hidden>)
 >Re: Creating Interface (From: Jean-Daniel Dupas <email@hidden>)

  • Prev by Date: Re: Design Question: Bindings & Custom Views
  • Next by Date: Seeking UI designer
  • Previous by thread: Re: Creating Interface
  • Next by thread: Re: Creating Interface
  • Index(es):
    • Date
    • Thread