Posts in underthehood

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 →

Autorelease - Under the Hood

Since this is an argument less touched but much important, I decided to write an article to organize the informations and explain how autorelease, or better autorelease pool works.

The main goal of this article is not to explain the base of what is an autorelease pool and when autorelease should be used, but anyway, this is really important to understand these concepts before proceeding. For this reason, the first paragraph will be dedicated to explain them. Experts developers, can safely skip it if they want.

written in arc, ios, mrc, objective-c, underthehood Read on →