A regression found in Xcode 26 Beta has forced me into a situation where I have to use Xcode 16.4 and Xcode 26 Beta side-by-side to compile the same sources.
This implies the same sources are compiled against the macOS 15 SDK and macOS 26 SDKs, depending on which Xcode version I’m using. In C/C++/Obj-C files, any use of symbols found only in the macOS 26 SDK can be bracketed within an #if defined(MAC_OS_VERSION_26_0) which keeps the resulting file compilable against the older SDK.
But in Swift? The #if os(mac) expression doesn’t support a version parameter… and there doesn’t seem to be an #if sdk(…) either. Are there alternative techniques? Older posts about this topic don’t suggest anything useful and they are 5 years old.
(I hope the question makes it clear that a runtime check via #available(macOS 26, *) statement wouldn’t really work here.)
Thanks!