Skip to content
This repository has been archived by the owner on Dec 4, 2018. It is now read-only.

Added fast forwarding to TLYDelegateProxy #137

Merged
merged 1 commit into from
May 16, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions TLYShyNavBar/Categories/TLYDelegateProxy.m
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,20 @@ - (instancetype)initWithMiddleMan:(id)middleMan
return self;
}

- (id)forwardingTargetForSelector:(SEL)sel
{
BOOL originalDelegateResponds = [self.originalDelegate respondsToSelector:sel];
BOOL middleManResponds = [self.middleMan respondsToSelector:sel];
if (originalDelegateResponds && !middleManResponds) {
return self.originalDelegate;
} else if (!originalDelegateResponds && middleManResponds) {
return self.middleMan;
} else {
// continue with "slow" forwarding
return self;
}
}

- (NSInvocation *)_copyInvocation:(NSInvocation *)invocation
{
NSInvocation *copy = [NSInvocation invocationWithMethodSignature:[invocation methodSignature]];
Expand Down