Objective-C Runtime Additions Allows Swizzling Without Creating A Category And More

I’ve mentioned a number of great Objective-C libraries to make things quicker and easier.

Today I came across an Objective-C library ObjectiveCRuntimeAdditions  that adds a couple of terrific additions to the Objective-C language.

The first addition is the ability to swizzle a method without the need to create a category – the readme states:

If you wanted to swizzle a method before, you would have to declare a category on a class (usually resulting in two extra files).

CTObjectiveCRuntimeAdditions introduces a new method

void class_swizzleSelectorWithBlock(Class class, SEL originalSelector, SEL unusedSelector, id block);

 which takes the class, the selector you want to swizzle, an unused selector in which the previous implementation will be stored and a block that will be called instead of the original implementation.

The second addition allows you to get detailed runtime information from your blocks.<

You can find CTObjectiveCRuntimeAdditions on Github here.

A couple of very useful additions.

DeliciousTwitterFacebookRedditLinkedInEmail

Original article: Objective-C Runtime Additions Allows Swizzling Without Creating A Category And More

©2012 iOS App Dev Libraries, Controls, Tutorials, Examples and Tools. All Rights Reserved.


Leave a Reply

Your email address will not be published. Required fields are marked *