You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Refactor DictionaryEncoder/DictionaryDecoder to struct + Sendable #3
DictionaryEncoder and DictionaryDecoder are currently open class. They should be converted to public struct and made Sendable.
Proposed Changes
struct + Sendable
open class DictionaryEncoder → public struct DictionaryEncoder: Sendable
open class DictionaryDecoder → public struct DictionaryDecoder: Sendable
open var properties → public var
userInfo
userInfo: [CodingUserInfoKey: Any] → userInfo: [CodingUserInfoKey: any Sendable] on both types
Update DictionaryEncoderOptions and DictionaryDecoderOptions to match
Bridge [CodingUserInfoKey: any Sendable] → [CodingUserInfoKey: Any] in DictionaryEncoderImpl/DictionaryDecoderImpl to satisfy the Encoder/Decoder protocol requirement
Unlike JSON, [String: Any] can hold a Date value natively — no serialization to string or number is needed. The strategies .secondsSince1970, .millisecondsSince1970, .iso8601, and .formatted(DateFormatter) only make sense for formats that cannot represent Date directly. For a dictionary, .deferredToDate is the only meaningful strategy, so the entire DateEncodingStrategy/DateDecodingStrategy enums can be removed. This also eliminates the DateFormatter / Sendable problem entirely and allows the struct to conform to Sendable without @unchecked.
Other Sendable fixes
MissingValueDecodingStrategy.useDefault(defaults: [String: Any]) → [String: any Sendable]
Add @Sendable to all closure-typed enum cases (DataEncodingStrategy.custom, KeyEncodingStrategy.custom, DataDecodingStrategy.custom, KeyDecodingStrategy.custom)
Activity