Add some Sendable conformances (#182)
This commit is contained in:
parent
5c6d5bfaf0
commit
b8c1e7c869
|
@ -53,7 +53,7 @@ extension Defaults {
|
||||||
}
|
}
|
||||||
|
|
||||||
extension Defaults {
|
extension Defaults {
|
||||||
public struct URLBridge: CodableBridge {
|
public struct URLBridge: CodableBridge, Sendable {
|
||||||
public typealias Value = URL
|
public typealias Value = URL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -296,7 +296,7 @@ extension Defaults {
|
||||||
}
|
}
|
||||||
|
|
||||||
extension Defaults {
|
extension Defaults {
|
||||||
public struct UUIDBridge: Bridge {
|
public struct UUIDBridge: Bridge, Sendable {
|
||||||
public typealias Value = UUID
|
public typealias Value = UUID
|
||||||
public typealias Serializable = String
|
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.
|
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 Value = Color
|
||||||
public typealias Serializable = Any
|
public typealias Serializable = Any
|
||||||
|
|
||||||
|
@ -428,7 +428,7 @@ extension Defaults {
|
||||||
}
|
}
|
||||||
|
|
||||||
extension Defaults {
|
extension Defaults {
|
||||||
public struct AnyBridge: Defaults.Bridge {
|
public struct AnyBridge: Defaults.Bridge, Sendable {
|
||||||
public typealias Value = Defaults.AnySerializable
|
public typealias Value = Defaults.AnySerializable
|
||||||
public typealias Serializable = Any
|
public typealias Serializable = Any
|
||||||
|
|
||||||
|
|
|
@ -89,7 +89,7 @@ extension Defaults {
|
||||||
|
|
||||||
- Important: The `UserDefaults` name must be ASCII, not start with `@`, and cannot contain a dot (`.`).
|
- 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:
|
It will be executed in these situations:
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue