Latest 0.4.0
License MIT
Platforms ios 7.0, requires ARC
Frameworks Foundation

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.

Latest podspec

    "name": "imp_implementationForwardingToSelector",
    "version": "0.4.0",
    "summary": "A trampoline that forwards an objc message to a different selector.",
    "homepage": "",
    "license": "MIT",
    "authors": {
        "Oliver Letterer": "[email protected]"
    "source": {
        "git": "",
        "tag": "0.4.0"
    "social_media_url": "",
    "platforms": {
        "ios": "7.0"
    "requires_arc": true,
    "frameworks": "Foundation",
    "source_files": "Source/*.{h,m,s}"

Pin It on Pinterest

Share This