i tried following the instructions at
https://docs.swift.org/swift-book/documentation/the-swift-programming-language/macros/#Implementing-a-Macro
to add a macro to my project. it didn’t work.
error: type 'Target' has no member 'macro'
.macro(name: "InlineASCIIMacro",
~^~~~~
error: type 'Any' has no member 'product'
.product(name: "SwiftSyntaxMacros", package: "swift-syntax"),
~^~~~~~~
error: type 'Any' has no member 'product'
.product(name: "SwiftCompilerPlugin", package: "swift-syntax"),
the reason? the Package.swift was missing the
import CompilerPluginSupport
which is not mentioned anywhere on that TSPL page. it should really mention that?
2 Likes
There's an open pull request: apple/swift-book#184
(TSPL uses the Swift Documentation category.)
3 Likes