Add some Sendable conformances (#182)

This commit is contained in:
Keita Watanabe 2024-07-23 21:04:02 +09:00 committed by GitHub
parent 5c6d5bfaf0
commit b8c1e7c869
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 5 deletions

View File

@ -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

View File

@ -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<Value: Serializable>: _AnyKey {
public final class Key<Value: Serializable>: _AnyKey, @unchecked Sendable {
/**
It will be executed in these situations: