Post

Replies

Boosts

Views

Activity

Swift Macros: error - Conformance to 'Prot' is not covered by macro 'macroName'
I'm trying to add protocol conformance with a macro The macro is defined as: protocol Prot {} @attached(extension, conformances: Prot) public macro MyMacro = #externalMacro(module: "MyMacro", type: "MyMacro") where MacroName is defined as: struct MyMacro: ExtensionMacro { public static func expansion(of node: AttributeSyntax, attachedTo declaration: some DeclGroupSyntax, providingExtensionsOf type: some TypeSyntaxProtocol, conformingTo protocols: [TypeSyntax], in context: some MacroExpansionContext) throws -> [ExtensionDeclSyntax] { // guard !protocols.isEmpty else { // return [] // } return [try ExtensionDeclSyntax("extension \(type.trimmed): Prot {}") ] } } The macro expands correctly adding the extension with the protocol conformance declaration correctly However, when I build the code (not the macro plugin, that builds fine) I get an error: Conformance to 'Prot' is not covered by macro 'MyMacro' Not sure how to solve this error? Anyone have a hint how to properly add protocol conformance using a macro? Incidentally, if I uncomment the guard statement I see that protocols is empty
2
0
1k
Oct ’23
how to collect logs from command line
I'm trying to collect logs on my mac from my app running on iPhone, but I always get an error. I use log collect as such: % sudo log collect --device --output log.logarchive --last 1m Archive successfully written to log.logarchive % sudo log show --archive log.logarchive/ log: Could not open log archive: The log archive is corrupt or incomplete and cannot be read so log show always claims the logs create by log collect are corrupt. I'm on maces monterey and iOS 15.3, and solution / tip? thanks
2
1
2.6k
Jan ’22