• 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: Why use protocols?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Why use protocols?


  • Subject: Re: Why use protocols?
  • From: Ondra Cada <email@hidden>
  • Date: Thu, 19 May 2005 22:29:41 +0200

Matt,

On 19.5.2005, at 21:47, Matt Neuburg wrote:

On Wed, 18 May 2005 20:03:05 +0200, Ondra Cada <email@hidden> said:

@implementation MyTableColumn
-dataCellForRow:(int)row {
  id ds=[[self tableView] dataSource];
  if ([ds respondsToSelector:@selector(dataCellForRow:sender:)])
    return [ds dataCellForRow:row sender:self];
  return [super dataCellForRow:row];
}


I completely agree in principle, and I do use this way too, but IIRC my
experience has been that the compiler warns (it doesn't know at compile time
that ds responds to dataCellForRow:sender:), whereas a formal protocol
prevents the warning... I may be misremembering, however.

Probably you forgot to import the informal protocol declaration when you tried. If the compiler knows about it, it does not complain (in fact, what the informal protocol declaration says to the compiler is "any NSObject subclass responds to dataCellForRow:sender:").
---
Ondra Čada
OCSoftware: email@hidden http://www.ocs.cz
private email@hidden http://www.ocs.cz/oc



_______________________________________________ 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
References: 
 >Re: Why use protocols? (From: Matt Neuburg <email@hidden>)

  • Prev by Date: Re: Drag a row and create a file
  • Next by Date: Re: When debugging myDocument, 'self' does not have a disclosure tirangle
  • Previous by thread: Re: Why use protocols?
  • Next by thread: Spotlight Plugin Woes
  • Index(es):
    • Date
    • Thread