PSTDelegateProxy 0.0.1

PSTDelegateProxy 0.0.1

TestsTested
LangLanguage Obj-CObjective C
License MIT
ReleasedLast Release Dec 2014

Maintained by Unclaimed.


Downloads

Total2,951
Week0
Month21

Installs

Apps21
Test Targets2
Watch Apps1
powered by Segment

GitHub

Stars234
Watchers11
Forks14
Issues0
Contributors3
Pull Requests2

Code

Files2
LOCLines of Code 97


  • By
  • Peter Steinberger

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.