I am writing a package in Swift using Xcode 16.1 (swift-tools-version: 6.0) and am trying to use features that became available in later versions of macOS and iOS.
The following line naturally causes a compiler error when compiling against 'My Mac':
let match = "test-string".firstMatch(of: /-(.+)/)!
'firstMatch(of:)' is only available in macOS 13.0 or newer
I can of course fix this by using @available(macOS 13.0, *), but there are dozens of methods and I would prefer to use the platforms property in the Package file like this:
platforms: [
.macOS(.v10_13),
.iOS(.v16)
],
However for reason that are not clear, this does not work and the compiler errors remain.
I have tried cleaning, removing derived data etc.
What I am doing wrong?