Skip to content

Commit 496fdae

Browse files
committed
✨ Omit empty strings
1 parent d361fef commit 496fdae

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Sources/Model/Event.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,3 +224,11 @@ extension Event {
224224
) }
225225
)
226226
}
227+
228+
extension KeyedEncodingContainer {
229+
mutating func encode(_ value: String, forKey key: K) throws {
230+
// omit empty strings from serialization
231+
guard !value.isEmpty else { return }
232+
try encodeIfPresent(value, forKey: key)
233+
}
234+
}

0 commit comments

Comments
 (0)