Add obj-c message forwarding to real object

This commit is contained in:
Jake Turner
2022-03-25 10:24:22 +00:00
committed by Baldur Karlsson
parent 260ecd28f6
commit 6ec18421bb
@@ -40,6 +40,24 @@
[super dealloc];
}
// Use the real MTLFunction to find methods from messages
- (NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector
{
id fwd = self.real;
return [fwd methodSignatureForSelector:aSelector];
}
// Forward any unknown messages to the real MTLFunction
- (void)forwardInvocation:(NSInvocation *)invocation
{
SEL aSelector = [invocation selector];
if([self.real respondsToSelector:aSelector])
[invocation invokeWithTarget:self.real];
else
[super forwardInvocation:invocation];
}
// MTLFunction : based on the protocol defined in
// Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk/System/Library/Frameworks/Metal.framework/Headers/MTLLibrrary.h