-
-
Notifications
You must be signed in to change notification settings - Fork 43
Expand file tree
/
Copy pathEncodedAt.swift
More file actions
21 lines (21 loc) · 897 Bytes
/
Copy pathEncodedAt.swift
File metadata and controls
21 lines (21 loc) · 897 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/// Indicates the field needs to be encoded to a specific
/// `CodingKey` path provided, different from the decoding path.
///
/// See ``CodedAt(_:)`` for all configurations and use-cases.
///
/// - Parameter path: The `CodingKey` path value located at for encoding only.
///
/// - Note: This macro on its own only validates if attached declaration
/// is a variable declaration. ``Codable(commonStrategies:)`` macro uses this macro
/// when generating final implementations.
///
/// - Important: When applied to fields, the field type must confirm to
/// `Encodable`.
///
/// - Important: This macro affects only encoding operations. Decoding will use
/// the default variable name or any encoding path specified with ``DecodedAt(_:)``.
@attached(peer)
@available(swift 5.9)
public macro EncodedAt(_ path: StaticString...) = #externalMacro(
module: "MacroPlugin", type: "EncodedAt"
)