Regex literals in Swift Packages

So far I'm unable to use Regex literals in my Swift Packages. Xcode simply gives a syntax error and has no idea I'm trying to do Regex.

This is with Xcode 14.1 and all the platforms in the Package.swift have been set to the minimum requirement (iOS 16, macOS 13, etc) as well as the swift-tools-version set to 5.7. Using the Regex type directly (try Regex("[a-z]")) does work. It's just the literals that Xcode refuses to recognize.

Regex literals do work in app projects and playgrounds.

Is there a setting in the Package.swift or something I'm forgetting?

Thanks in advance!

Answered by freek in 735056022

Alright, after actually reading the Swift Evolution regarding the Regex literals I noticed the section of literals wrapped with a #. These seem to work. :)

Accepted Answer

Alright, after actually reading the Swift Evolution regarding the Regex literals I noticed the section of literals wrapped with a #. These seem to work. :)

Exact same issue except Xcode 14.2

all the platforms in the Package.swift have been set to the minimum requirement (iOS 16, macOS 13, etc) as well as the swift-tools-version set to 5.7

and

Regex literals do work in app projects and playgrounds.

Ditto. Very strange

Regex literals in Swift Packages
 
 
Q