I create a simple project with "swift package init".
It failed to compile with "swift build". It seems that the compiler does not recognize the regex literal at all:
If I remember correctly, the bare slash literals are an upcoming feature that needs to be manually enabled in your Package.swift manifest (or Xcode build settings) for now.
In your target's swiftSettings, you might need to add ```
Thanks @tkrajacic and @SimplyDanny .
Add the configurations you mentioned. Following Package.swift works like a charm!
import PackageDescription
let package = Package(
name: "LearningSwift",
platforms: [
.macOS(.v13),
],
targets: [
// Targets are the basic building blocks of a package, defining a module or a test suite.
// Targets can depend on other targets in this package and products from dependencies.
.executableTarget(name: "LearningSwift", swiftSettings: [.enableUpcomingFeature("BareSlashRegexLiterals")])
]
)