Over a million developers have joined DZone.

Injection for Xcode

DZone's Guide to

Injection for Xcode

· Mobile Zone ·
Free Resource

Now here’s something we missed back earlier this year: Injection for Xcode!

Using Injection it is possible to make a change to the implementation of an Objective-C® class and have it take effect as soon as the class is saved without having to restart the application. This feature works for OS X and iOS applications in the simulator and on iOS devices.

Injection works by converting your classes into categories using a small set of preprocessor macros. This category can then be loaded at run time using a bundle. As Objective-C “binds” at runtime it will always chose the new implementation of the class over that which the application was last built with…

That sounds like pretty much the niftiest tool you’ve never heard of, doesn’t it? Unfortunately, seems like neither did anybody else, and Apple put it in the “we’ll just sit on this submission forever” limbo…

Screen Shot 2012-12-08 at 7.42.37 AM.png

… but hey, now it’s up on github for you!

h/t: @romainbriche!


Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}