Skip to content


Folders and files

Last commit message
Last commit date

Latest commit



4 Commits

Repository files navigation


Version Platform License Badge

imp_implementationForwardingToSelector is a trampoline that forwards an objc message to a different selector.


imp_implementationForwardingToSelector is available through CocoaPods, to install it simply add the following line to your Podfile:

pod "imp_implementationForwardingToSelector"

How it works

Message forwarding

imp_implementationForwardingToSelector is a custom trampoline (you can read about trampolines here) which can forward any objc message to a new selector.

IMP imp_implementationForwardingToSelector(SEL forwardingSelector, BOOL returnsAStructValue);

Here is an example

IMP forwardingImplementation = imp_implementationForwardingToSelector(@selector(setCenter:), NO);
class_addMethod([UIView class], @selector(thisSetCenterDoesNotExistYet:), forwardingImplementation, typeEncoding);

and suddenly every instance of UIView responds to -[UIView thisSetCenterDoesNotExistYet:] and forwards this message to -[UIView setCenter:]. If you would like some more information about trampolines and maybe a blog post like Writing custom trampolines for beginners and all the pitfalls, hit me up on Twitter.


imp_implementationForwardingToSelector is written in raw assembly which is currently only available on i386, armv7, armv7s and arm64.


Oliver Letterer


imp_implementationForwardingToSelector is available under the MIT license. See the LICENSE file for more info.