A Swift macro for compile-time URL validation. Replaces URL(string:)! with #URL() for safer, non-optional URLs.
import URLMacro let url = #URL("https://example.com") // Compiles to: URL(string: "https://example.com")!Invalid URLs produce a compile-time error:
let url = #URL("not a url") // ❌ Compile error: malformed URLAdd to your Package.swift:
.package(url: "https://github.com/dodobrands/swift-url-macro", from: "1.0.0"),Then add "URLMacro" to your target dependencies.
Use with the urlMacro rule:
--enable urlMacro --url-macro "#URL,URLMacro" MIT