Re: Overriding Methods via Category Now A no-no?
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