Contents

ReportableMetadataKey(_:)

Specifies a custom key name for a property in the generated metadataDictionary.

Declaration

@attached(peer) macro ReportableMetadataKey(_ key: String)

Mentioned in

Overview

By default, property names are used as dictionary keys. Use this macro to provide a different key name, such as for compatibility with server APIs or naming conventions.

@ReportableMetadata
struct SessionMetadata {
    @ReportableMetadataKey("uid") var userID: String
    var region: String
}

See Also

Metadata type macros