I'm working on building a tool that can run on both Linux machines (think github actions) as well as locally on a mac. I need to parse some regexes and I would like to use regex builders. I've created a basic Package.swift
for the tool.
Sorry if it's already been posted here, but I wasn't sure how to get something like this working:
import RegexBuilder
struct SomeType {
var a: Int
var b: Int
}
// Xcode prompts me to add this locally,
// but how do I include
// linux as a destination
@available(macOS 13.0, *) // <<<-------
extension SomeType {
static func fromString(_ str: String) throws -> SomeType {
let aRef = Reference(Int.self)
let bRef = Reference(Int.self)
let regex = Regex {
// ...
}
let match: Regex<_>.Match = ...
return SomeType(a: match[aRef], b: match[bRef])
}
}
Do I need to specify something in the Package.swift
to make this work to set a minimum version for mac and linux or is there some @available
that will work for this?