• 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: Overriding Methods via Category Now A no-no?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Overriding Methods via Category Now A no-no?


  • Subject: Re: Overriding Methods via Category Now A no-no?
  • From: Wade Tregaskis <email@hidden>
  • Date: Mon, 26 Mar 2012 17:35:27 -0700

Clang now complains with, "Category is implementing a method which will also be implemented by its primary class", but I understood that overriding methods via category was perfectly fine although with some drawbacks.

Yikes, where did the docs say that? I’ve always assumed it was unsupported/disallowed.

It's discouraged, but it's not uncommon and there are many cases where it's immensely useful, often in concert with method swizzling.

The drawbacks include ambiguity in the face of multiple callbacks overriding the same method, as someone else already noted.  But for many projects you have sufficient control that you can avoid that (mostly; some Apple frameworks also use this technique internally, so you can't be 100% sure your single override isn't actually the second one on the scene...).
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Overriding Methods via Category Now A no-no? (From: Keary Suska <email@hidden>)
 >Re: Overriding Methods via Category Now A no-no? (From: Jens Alfke <email@hidden>)

  • Prev by Date: Re: Overriding Methods via Category Now A no-no?
  • Next by Date: Re: XCode 4 & copied frameworks
  • Previous by thread: Re: Overriding Methods via Category Now A no-no?
  • Next by thread: XCode 4 & copied frameworks
  • Index(es):
    • Date
    • Thread