Does @available work on Mac Catalyst AppKit Bundle Plugin?

A Mac Catalyst App Creates an AppKit Bundle Plugin in which @available does not work。

In AppKit Bundle Plugin, there is not watchOS and iOS version can not be higher than 28, but the log has been output. if (@available(watchOS 18.0, *)) { NSLog(@"bundle is available watchOS"); }

if (@available(iOS 28.0, *)) { NSLog(@"bundle is available iOS"); }

demo link: https://pan.baidu.com/s/1s_5qmsL6Bh-df3A1PfD0OA Extracted code: 5ndj

Placing a macOS bundle target inside of a Mac Catalyst app in order to use AppKit is not a supported configuration. See the Important box in the documentation);

Mac apps built with Mac Catalyst can only use AppKit APIs marked as available in Mac Catalyst, such as NSToolbar and NSTouchBar. Mac Catalyst doesn’t support accessing unavailable AppKit APIs.

Since there's no supported scenario for your target setup as you show, we cannot reason about the circumstances pertaining to the availability checking here.

Please file enhancement requests for any functionality from AppKit that you would like to see available in the Mac Catalyst environment.

— Ed Ford,  DTS Engineer

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

Does @available work on Mac Catalyst AppKit Bundle Plugin?
 
 
Q