In AppKit Bundle Plugin, how to determine whether the API is available in different system versions?
For example, commandBufferWithDescriptor is available on macCatalyst 14.0 and commandBuffer is is available on macCatalyst 13.1. The code is crashed on macOS 10.15.7.
id<MTLDevice> device = MTLCreateSystemDefaultDevice();
id<MTLCommandQueue> queue = [device newCommandQueue];
if (@available(macCatalyst 14.0, *))
{
NSLog(@"bundle is macCatalyst 14.0");
MTLCommandBufferDescriptor* desc = [[MTLCommandBufferDescriptor alloc] init];
return [queue commandBufferWithDescriptor:desc];
}
else
{
NSLog(@"bundle is macCatalyst 13.0");
return [queue commandBuffer];
}
demo link: https://pan.baidu.com/s/1dpEwvSPVk312XKmbTfzNzA Extracted code: btfl