'member' macro cannot be attached to property

Using the CustomCodable / CodableKey macros from here https://github.com/DougGregor/swift-macro-examples/blob/main/MacroExamplesPlugin/CustomCodable.swift.

Using Xcode 15 Beta 6 this example i am now getting a error i did not get with Beta 5

public struct User: Codable, Equatable {
    @CodableKey("email") public var emailAddress: String // 'member' macro cannot be attached to property

I think/hope this is a bug, since the same approach is also used in the examples repo.

1 Like

Looks like the same problem as reported in 'accessor' macro cannot be attached to a parameter.

It is!

In this case, you should be able to switch your CodableKey macro from a member macro to a peer macro.

1 Like

Thanks that fixed it! :raised_hands:

1 Like