Posts in extending

Extending Methods in a Category by Method Swizzling

Probably you have been in the situation to being writing a category and at some point exclaim “F**K! It’s a category!”. Yes, and probably was because you accidentally tried to override a method without remembering that effectively, you were writing in a category.

In the largest percentage of situations, when you need to override a method, you want to write a subclass; when instead you want to write a category for a class, it is because you probably need to have some new methods or properties that you’d like to be used from every subclass.

There is only another situation which could confuse you, and this is when you are in both the previous cases, together.

written in categories, extending, ios, objective-c, swizzling, underthehood Read on →