Skip to content

Commit ce5fdde

Browse files
Added dictionary literal support
1 parent 0815b8a commit ce5fdde

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Sources/DynamicCodable/DynamicCodable+Literals.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,13 @@ extension DynamicCodable: ExpressibleByArrayLiteral {
4848
}
4949
}
5050

51+
extension DynamicCodable: ExpressibleByDictionaryLiteral {
52+
@inlinable
53+
public init(dictionaryLiteral elements: (Key, DynamicCodable)...) {
54+
self = .keyed(Dictionary(elements, uniquingKeysWith: { first, _ in first }))
55+
}
56+
}
57+
5158

5259
extension DynamicCodable.Key: ExpressibleByIntegerLiteral {
5360
@inlinable

0 commit comments

Comments
 (0)