@Polyphonic: Thanks for the reply. I understand what @unchecked Sendable means and I agree that this would mean that NSImage is Sendable – but the thing that prompted this question was that the extension is marked as unavailable on all platforms and versions (because of the *). So what does it mean when a class conforms to a protocol in an unavailable extension?
The following experiments use “Complete” for SWIFT_STRICT_CONCURRENCY:
Xcode 14, macOS 13 SDK, macOS 13 Deployment Target
I tried returning an NSImage from an async top-level method and that gives me this warning:
Xcode 15, macOS 14 SDK, macOS 14 Deployment Target
The same code compiles without the hint at the import Cocoa line, which I would interpret to mean that the macOS 14 SDK has been fully audited for Sendability and suppressing the warnings isn’t an option anymore (not that I would want to do that):
Just to make sure, I also tried it with an actor:
So the compiler definitely does know that NSImage is not Sendable, which means the availability annotation in that extension I originally mentioned does not add Sendability conformance but instead seems to document the opposite. This can also be verified by adding the following (unwise) extension to the code in the screenshots, which “fixes” the warning:
extension NSImage: @unchecked Sendable {}
Topic:
UI Frameworks
SubTopic:
AppKit
Tags: