Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Branch: master
Fetching contributors…

Cannot retrieve contributors at this time

38 lines (30 sloc) 0.706 kB
@import "BlankSlate.j"
/**
* A class used to proxy messages to a delegate, but not raise an error if that
* delegate does not have a given message.
*/
@implementation DelegateProxy : BlankSlate
{
id delegate;
}
+ (DelegateProxy)proxyWithDelegate:(id)aDelegate
{
return [[self alloc] initWithDelegate:aDelegate];
}
- (DelegateProxy)initWithDelegate:(id)aDelegate
{
delegate = aDelegate;
return self;
}
- (id)methodSignatureForSelector:(SEL)aSelector
{
return true;
}
- (id)forwardInvocation:(CPInvocation)anInvocation
{
if ([delegate respondsToSelector:[anInvocation selector]])
return [anInvocation invokeWithTarget:delegate];
else
return null;
}
@end
Jump to Line
Something went wrong with that request. Please try again.