Passes a given invocation to the real object the proxy represents.
SDKs
- iOS 2.0+
- macOS 10.0+
- tvOS 9.0+
- watchOS 2.0+
Framework
- Foundation
Declaration
func forwardInvocation(_ invocation: NSInvocation)
Parameters
anInvocation
The invocation to forward.
Discussion
NSProxy
’s implementation merely raises NSInvalid
. Override this method in your subclass to handle an
appropriately, at the very least by setting its return value.
For example, if your proxy merely forwards messages to an instance variable named real
, it can implement forward
like this:
- (void)forwardInvocation:(NSInvocation *)anInvocation
{
[anInvocation setTarget:realObject];
[anInvocation invoke];
return;
}