• 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: Instancetype and refactoring methods
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Instancetype and refactoring methods


  • Subject: Re: Instancetype and refactoring methods
  • From: Jens Alfke <email@hidden>
  • Date: Mon, 09 Nov 2015 11:20:09 -0800

> On Nov 9, 2015, at 10:58 AM, Alex Zavatone <email@hidden> wrote:
>
> Before I give it a shot, is this a case where using instancetype to return the instance of the object that holds the method a better choice than id?

It sounds like your delegate API is using the old “informal protocol” mechanism where you declare the methods in a category on NSObject. Instead, it’s best to define a protocol for the delegate type and always refer to the delegate using that protocol. (You’ve probably seen that AppKit and Foundation switched over to this a few years ago.)

—Jens
_______________________________________________

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: Instancetype and refactoring methods
      • From: Alex Zavatone <email@hidden>
References: 
 >Instancetype and refactoring methods (From: Alex Zavatone <email@hidden>)

  • Prev by Date: Instancetype and refactoring methods
  • Next by Date: Re: Instancetype and refactoring methods
  • Previous by thread: Instancetype and refactoring methods
  • Next by thread: Re: Instancetype and refactoring methods
  • Index(es):
    • Date
    • Thread