Skip to content

Commit cd7c2b8

Browse files
committed
rm legacy Swift
1 parent cc532c8 commit cd7c2b8

13 files changed

Lines changed: 8 additions & 64 deletions

.github/workflows/swift_macos.yml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,23 @@ on:
55
branches:
66
- "main"
77
- $default-branch
8+
- "rm_legacy"
89
paths:
910
- ".github/workflows/**"
1011
- "Package.swift"
1112
- "Source/**"
13+
- "Sources/**"
1214
- "Tests/**"
1315
pull_request:
16+
branches:
17+
- "main"
18+
- $default-branch
19+
- "rm_legacy"
1420
paths:
1521
- ".github/workflows/**"
1622
- "Package.swift"
1723
- "Source/**"
24+
- "Sources/**"
1825
- "Tests/**"
1926

2027
concurrency:
@@ -39,14 +46,6 @@ jobs:
3946
runsOn: macOS-15
4047
swift: "6.0"
4148
outputFilter: xcbeautify --renderer github-actions
42-
- xcode: "Xcode_15.4"
43-
runsOn: macOS-14
44-
swift: "5.10"
45-
outputFilter: xcbeautify --renderer github-actions
46-
- xcode: "Xcode_15.2"
47-
runsOn: macOS-14
48-
swift: "5.9"
49-
outputFilter: xcbeautify --renderer github-actions
5049
steps:
5150
- uses: swift-actions/setup-swift@v2
5251
with:

Source/Defaults.swift

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import Combine
22
import Foundation
33

4-
#if swift(>=6.0)
54
@MainActor
65
#endif
76
/// A property wrapper that stores and observes values in `UserDefaults` with support for encoding and decoding.
@@ -19,8 +18,7 @@ public final class Defaults<Value: Codable & Equatable> {
1918
private let defaultValue: Value
2019
private let defaultsObserver: DefaultsObserver
2120

22-
#if swift(>=6.0)
23-
private nonisolated(unsafe) var notificationToken: (any NSObjectProtocol)?
21+
private nonisolated(unsafe) var notificationToken: (any NSObjectProtocol)?
2422
#else
2523
private var notificationToken: (any NSObjectProtocol)?
2624
#endif
@@ -199,7 +197,6 @@ public extension Defaults where Value: ExpressibleByDictionaryLiteral, Value.Key
199197

200198
#if swift(>=6.0)
201199
extension Defaults: @unchecked Sendable {}
202-
#endif
203200

204201
private final class DefaultsObserver: NSObject {
205202
private let userDefaults: UserDefaults
@@ -245,11 +242,6 @@ extension DefaultsObserver: @unchecked Sendable {}
245242
private struct UnsafeSendable<T>: @unchecked Sendable {
246243
let value: T
247244
}
248-
#else
249-
struct UnsafeSendable<T> {
250-
let value: T
251-
}
252-
#endif
253245

254246
extension UnsafeSendable {
255247
init(_ value: T) {

Source/Expirable.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,4 @@ public struct Expirable<Value: ExpressibleByNilLiteral> {
6161

6262
extension Expirable: Equatable where Value: Equatable {}
6363

64-
#if swift(>=6.0)
6564
extension Expirable: @unchecked Sendable {}
66-
#endif

Source/Keychain.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,5 @@ public extension Keychain {
203203
}
204204
}
205205

206-
#if swift(>=6.0)
207206
extension Keychain: Sendable {}
208207
extension KeychainError: Sendable {}
209-
#endif

Source/Lifetime.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,4 @@ extension Lifetime: Codable {
122122
}
123123
}
124124

125-
#if swift(>=6.0)
126125
extension Lifetime: Sendable {}
127-
#endif

Source/Storage.swift

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ public typealias ValueSubject<Value> = CurrentValueSubject<Value, Never>
1111
/// This is a common output type for observing storage value changes.
1212
public typealias ValuePublisher<Value> = AnyPublisher<Value, Never>
1313

14-
#if swift(>=6.0)
1514
/// A protocol that defines a reactive storage interface for reading and writing values.
1615
///
1716
/// `Storage` abstracts the concept of value persistence with support for Combine-based observation.
@@ -38,27 +37,6 @@ public protocol Storage<Value>: AnyObject, Sendable, ObservableObject {
3837
/// - Returns: An `AnyCancellable` that can be used to cancel the subscription.
3938
func sink(receiveValue: @escaping @Sendable (Value) -> Void) -> AnyCancellable
4039
}
41-
#else
42-
/// A protocol that defines the interface for storing and retrieving values.
43-
/// Storage implementations provide a way to persist and observe changes to values.
44-
///
45-
/// The protocol combines Combine's `ObservableObject` with a value storage mechanism,
46-
/// allowing for reactive updates when values change.
47-
public protocol Storage<Value>: AnyObject, ObservableObject {
48-
associatedtype Value
49-
50-
/// A publisher that emits the current value and any subsequent changes.
51-
var eventier: ValuePublisher<Value> { get }
52-
53-
/// The current value stored in the storage.
54-
var value: Value { get set }
55-
56-
/// Subscribes to value changes and returns a cancellable subscription.
57-
/// - Parameter receiveValue: A closure that is called with the new value whenever it changes.
58-
/// - Returns: A cancellable subscription that can be used to stop receiving updates.
59-
func sink(receiveValue: @escaping (Value) -> Void) -> AnyCancellable
60-
}
61-
#endif
6240

6341
public extension Storage {
6442
/// Default implementation of `sink(receiveValue:)` that forwards to the `eventier` publisher.

Source/StorageComposition.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,4 @@ internal final class StorageComposition<Value: ExpressibleByNilLiteral & Equatab
115115
}
116116
}
117117

118-
#if swift(>=6.0)
119118
extension StorageComposition: @unchecked Sendable {}
120-
#endif

Source/Storages/AnyStorage.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,4 @@ public extension Storage {
6363
}
6464
}
6565

66-
#if swift(>=6.0)
6766
extension AnyStorage: @unchecked Sendable {}
68-
#endif

Source/Storages/FileStorage.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,4 @@ where Value: ExpressibleByNilLiteral & Codable {
111111
}
112112
}
113113

114-
#if swift(>=6.0)
115114
extension FileStorage: @unchecked Sendable {}
116-
#endif

Source/Storages/InMemoryStorage.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,4 @@ public extension InMemoryStorage where Value: ExpressibleByNilLiteral {
4242
}
4343
}
4444

45-
#if swift(>=6.0)
4645
extension InMemoryStorage: @unchecked Sendable {}
47-
#endif

0 commit comments

Comments
 (0)