From a056ff361066b87ab85e3fc9923e9921cc35f37e Mon Sep 17 00:00:00 2001 From: Keita Watanabe Date: Tue, 23 Jul 2024 15:58:34 +0900 Subject: [PATCH] add Sendables --- Sources/Defaults/Defaults+Bridge.swift | 8 ++++---- Sources/Defaults/Defaults.swift | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Sources/Defaults/Defaults+Bridge.swift b/Sources/Defaults/Defaults+Bridge.swift index a283d5e..b1da6fc 100644 --- a/Sources/Defaults/Defaults+Bridge.swift +++ b/Sources/Defaults/Defaults+Bridge.swift @@ -53,7 +53,7 @@ extension Defaults { } extension Defaults { - public struct URLBridge: CodableBridge { + public struct URLBridge: CodableBridge, Sendable { public typealias Value = URL } } @@ -296,7 +296,7 @@ extension Defaults { } extension Defaults { - public struct UUIDBridge: Bridge { + public struct UUIDBridge: Bridge, Sendable { public typealias Value = UUID public typealias Serializable = String @@ -373,7 +373,7 @@ extension Defaults { It is unsafe to convert `SwiftUI.Color` to `UIColor` and use `UIColor.bridge` to serialize it, because `UIColor` does not hold a color space, but `Swift.Color` does (which means color space might get lost in the conversion). The bridge will always try to preserve the color space whenever `Color#cgColor` exists. Only when `Color#cgColor` is `nil`, will it use `UIColor.bridge` to do the serialization and deserialization. */ - public struct ColorBridge: Bridge { + public struct ColorBridge: Bridge, Sendable { public typealias Value = Color public typealias Serializable = Any @@ -428,7 +428,7 @@ extension Defaults { } extension Defaults { - public struct AnyBridge: Defaults.Bridge { + public struct AnyBridge: Defaults.Bridge, Sendable { public typealias Value = Defaults.AnySerializable public typealias Serializable = Any diff --git a/Sources/Defaults/Defaults.swift b/Sources/Defaults/Defaults.swift index dfa4731..88b040d 100644 --- a/Sources/Defaults/Defaults.swift +++ b/Sources/Defaults/Defaults.swift @@ -89,7 +89,7 @@ extension Defaults { - Important: The `UserDefaults` name must be ASCII, not start with `@`, and cannot contain a dot (`.`). */ - public final class Key: _AnyKey { + public final class Key: _AnyKey, @unchecked Sendable { /** It will be executed in these situations: