Function Body Macros で、SwiftUI の View に Accessibility Identifier を自動付与する/Function Body Macros: Autogenerate accessibility identifiers for SwiftUI Views
create the body for a function that does not /// have one. public protocol BodyMacro: AttachedMacro { /// Expand a macro described by the given custom attribute and /// attached to the given declaration and evaluated within a /// particular expansion context. /// /// The macro expansion can introduce a body for the given function. static func expansion( of node: AttributeSyntax, providingBodyFor declaration: some DeclSyntaxProtocol & WithOptionalCodeBlockSyntax, in context: some MacroExpansionContext ) throws -> [CodeBlockItemSyntax] }
The macro expansion can introduce a body for the given function. static func expansion( of node: AttributeSyntax, providingBodyFor declaration: some DeclSyntaxProtocol & WithOptionalCodeBlockSyntax, in context: some MacroExpansionContext ) throws -> [CodeBlockItemSyntax]
ͷ్தͷ߹εΩοϓ͢Δ 21 // Skip if in the middle of a modifier chain if let parent = node.parent, parent.is(MemberAccessExprSyntax.self) { return super.visit(node) }