Skip to content

Commit 025edc4

Browse files
committed
drop Swift 5.10 fallback, inline Sendable conformances
1 parent 0c6744f commit 025edc4

13 files changed

Lines changed: 0 additions & 105 deletions

Package@swift-5.10.swift

Lines changed: 0 additions & 34 deletions
This file was deleted.

Source/Defaults.swift

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,7 @@ public final class Defaults<Value: Codable & Equatable> {
1515
private let key: String
1616
private let defaultValue: Value
1717
private let defaultsObserver: DefaultsObserver
18-
19-
#if swift(>=6.0)
2018
private nonisolated(unsafe) var notificationToken: (any NSObjectProtocol)?
21-
#else
22-
private var notificationToken: (any NSObjectProtocol)?
23-
#endif
2419

2520
private let decoderGenerator: () -> JSONDecoder
2621
private lazy var decoder: JSONDecoder = decoderGenerator()
@@ -119,14 +114,9 @@ public final class Defaults<Value: Codable & Equatable> {
119114

120115
private nonisolated func syncMain() {
121116
assert(Thread.isMainThread, "Should be used only in main thread")
122-
123-
#if swift(>=6.0)
124117
MainActor.assumeIsolated {
125118
notifyAboutChanges()
126119
}
127-
#else
128-
notifyAboutChanges()
129-
#endif
130120
}
131121

132122
private func notifyAboutChanges() {
@@ -222,12 +212,7 @@ public extension Defaults where Value: ExpressibleByBooleanLiteral {
222212
private final class DefaultsObserver: NSObject {
223213
private let userDefaults: UserDefaults
224214
private let key: String
225-
226-
#if swift(>=6.0)
227215
var updateHandler: (@Sendable (_ new: Any?) -> Void)?
228-
#else
229-
var updateHandler: ((_ new: Any?) -> Void)?
230-
#endif
231216

232217
required init(key: String,
233218
userDefaults: UserDefaults) {
@@ -266,9 +251,6 @@ extension UnsafeSendable {
266251
self.value = value
267252
}
268253
}
269-
270-
#if swift(>=6.0)
271254
extension Defaults: @unchecked Sendable {}
272255
extension DefaultsObserver: @unchecked Sendable {}
273256
extension UnsafeSendable: @unchecked Sendable {}
274-
#endif

Source/Expirable.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,4 @@ public extension Expirable where Value: ExpressibleByBooleanLiteral {
118118

119119
extension Expirable: Codable where Value: Codable {}
120120
extension Expirable: Equatable where Value: Equatable {}
121-
122-
#if swift(>=6.0)
123121
extension Expirable: @unchecked Sendable {}
124-
#endif

Source/Keychain.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,5 @@ public extension Keychain {
203203
}
204204
}
205205
}
206-
207-
#if swift(>=6.0)
208206
extension Keychain: Sendable {}
209207
extension KeychainError: Sendable {}
210-
#endif

Source/Lifetime.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,4 @@ extension Lifetime: Codable {
123123
try container.encode(interval)
124124
}
125125
}
126-
127-
#if swift(>=6.0)
128126
extension Lifetime: Sendable {}
129-
#endif

Source/Storage.swift

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import Combine
22
import Foundation
3-
4-
#if swift(>=6.0)
53
/// A protocol that defines a reactive storage interface for reading and writing values.
64
///
75
/// `Storage` abstracts the concept of value persistence with support for Combine-based observation.
@@ -28,27 +26,6 @@ public protocol Storage<Value>: AnyObject, Sendable, ObservableObject {
2826
/// - Returns: An `AnyCancellable` that can be used to cancel the subscription.
2927
func sink(receiveValue: @escaping @Sendable (Value) -> Void) -> AnyCancellable
3028
}
31-
#else
32-
/// A protocol that defines the interface for storing and retrieving values.
33-
/// Storage implementations provide a way to persist and observe changes to values.
34-
///
35-
/// The protocol combines Combine's `ObservableObject` with a value storage mechanism,
36-
/// allowing for reactive updates when values change.
37-
public protocol Storage<Value>: AnyObject, ObservableObject {
38-
associatedtype Value
39-
40-
/// A publisher that emits the current value and any subsequent changes.
41-
var eventier: AnyPublisher<Value, Never> { get }
42-
43-
/// The current value stored in the storage.
44-
var value: Value { get set }
45-
46-
/// Subscribes to value changes and returns a cancellable subscription.
47-
/// - Parameter receiveValue: A closure that is called with the new value whenever it changes.
48-
/// - Returns: A cancellable subscription that can be used to stop receiving updates.
49-
func sink(receiveValue: @escaping (Value) -> Void) -> AnyCancellable
50-
}
51-
#endif
5229

5330
/// Convenience helpers for combining and subscribing to storages.
5431
public extension Storage {

Source/StorageComposition.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,4 @@ extension StorageComposition where Value: ExpressibleByBooleanLiteral {
161161
try self.init(storages: storages, defaultValue: false)
162162
}
163163
}
164-
165-
#if swift(>=6.0)
166164
extension StorageComposition: @unchecked Sendable {}
167-
#endif

Source/Storages/AnyStorage.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,4 @@ public extension Storage {
6363
return AnyStorage(self)
6464
}
6565
}
66-
67-
#if swift(>=6.0)
6866
extension AnyStorage: @unchecked Sendable {}
69-
#endif

Source/Storages/FileStorage.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,4 @@ public extension FileStorage where Value: ExpressibleByBooleanLiteral {
183183
defaultValue: false)
184184
}
185185
}
186-
187-
#if swift(>=6.0)
188186
extension FileStorage: @unchecked Sendable {}
189-
#endif

Source/Storages/InMemoryStorage.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,4 @@ public extension InMemoryStorage where Value: ExpressibleByBooleanLiteral {
6363
self.init(value: false)
6464
}
6565
}
66-
67-
#if swift(>=6.0)
6866
extension InMemoryStorage: @unchecked Sendable {}
69-
#endif

0 commit comments

Comments
 (0)