Latest Post
Making a Swift Macro
Today I made a Swift Macro that expands to a force-unwrapped URL initializer. Xcode has a template project showing a freestanding macro stringify and it provided a good starting point for me. The part where I had to work with the internals of SwiftSyntax was tough as I don’t have any experience working with the compiler or anything lower level. In the end, the macro works in a main.swift file as well as two unit tests powered by XCTest. The part where it’s satisfying is not seeing the macro work but seeing Xcode showing the error message I wrote in the macro.
