Latest 0.0.1
Homepage https://github.com/steipete/PSTDelegateProxy
License MIT
Platforms ios 6.0, requires ARC
Authors

A simple proxy that forwards optional methods to delegates – less boilerplate in your code!

When calling optional delegates, the regular pattern is to check using respondsToSelector:, then actually call the method. This is straightforward and easy to understand:

    id<PSPDFResizableViewDelegate> delegate = self.delegate;
    if ([delegate respondsToSelector:@selector(resizableViewDidBeginEditing:)]) {
        [delegate resizableViewDidBeginEditing:self];
    }

What we really want is something like this:

    [self.delegateProxy resizableViewDidBeginEditing:self];

Read more on my blog: Smart Proxy Delegation

License

MIT License.

Latest podspec

{
    "name": "PSTDelegateProxy",
    "version": "0.0.1",
    "summary": "A simple proxy that forwards optional methods to delegates",
    "description": "                   Calling optional delegate methods usually needs lots ofn                   boilerplate code, because we need to check if the delegaten                   responds to a given selector. Using `NSProxy` we can reducen                   such boilerplate code and just call the optional method.n                   We also get compiler checks for method signatures.n",
    "homepage": "https://github.com/steipete/PSTDelegateProxy",
    "license": "MIT",
    "authors": {
        "Peter Steinberger": "[email protected]"
    },
    "platforms": {
        "ios": "6.0"
    },
    "source": {
        "git": "https://github.com/steipete/PSTDelegateProxy.git",
        "commit": "535c16db5212bf7ef7757c344ee7738e9fb95009"
    },
    "source_files": "PSTDelegateProxy.{h,m}",
    "requires_arc": true
}

Pin It on Pinterest

Share This