Regex literals in Xcode 14.1 + packages + Swift 5.7

I found that in Xcode 14.1, if you have a Swift package in your workspace and try to use regex literals in it, they won't be parsed, build will fail and Xcode will complain (although I do use // swift-tools-version: 5.7).

Weird enough if you do the same in a regular Xcode project, all works fine. Is this something known/any idea how to fix it?

Regex literals are available in swift packages, but the "bare-slash literal syntax" is disabled by default. You can either use the #/.../# syntax, or pass -enable-bare-slash-regex to enable support for /.../.

swift-evolution/0362-piecemeal-future-features.md at main · apple/swift-evolution · GitHub has been accepted and should bring better support for controlling this sort of feature.

1 Like

Ah, I don't know how I've missed that. Thanks, works as expected!

1 Like