Skip to content

Commit 7a4a168

Browse files
committed
Fixes after updating with upstream.
1 parent 2e24b25 commit 7a4a168

File tree

6 files changed

+36
-36
lines changed

6 files changed

+36
-36
lines changed

Sources/ComposableArchitecture/Internal/LocalizedStringKey.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import SwiftUI
22

3+
@available(iOS 13.0, macOS 10.15, macCatalyst 13, tvOS 13.0, watchOS 6.0, *)
34
extension LocalizedStringKey: CustomDebugOutputConvertible {
45
// NB: `LocalizedStringKey` conforms to `Equatable` but returns false for equivalent format strings.
56
public func formatted(locale: Locale? = nil) -> String {

Sources/ComposableArchitecture/SwiftUI/Alert.swift

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ import SwiftUI
9090
/// }
9191
/// )
9292
///
93+
@available(iOS 13.0, macOS 10.15, macCatalyst 13, tvOS 13.0, watchOS 6.0, *)
9394
public struct AlertState<Action> {
9495
public let id = UUID()
9596
public var message: LocalizedStringKey?
@@ -158,11 +159,7 @@ public struct AlertState<Action> {
158159
}
159160
}
160161

161-
@available(iOS 13, *)
162-
@available(macCatalyst 13, *)
163-
@available(macOS 10.15, *)
164-
@available(tvOS 13, *)
165-
@available(watchOS 6, *)
162+
@available(iOS 13.0, macOS 10.15, macCatalyst 13, tvOS 13.0, watchOS 6.0, *)
166163
extension View {
167164
/// Displays an alert when then store's state becomes non-`nil`, and dismisses it when it becomes
168165
/// `nil`.
@@ -185,6 +182,7 @@ extension View {
185182
}
186183
}
187184

185+
@available(iOS 13.0, macOS 10.15, macCatalyst 13, tvOS 13.0, watchOS 6.0, *)
188186
extension AlertState: CustomDebugOutputConvertible {
189187
public var debugOutput: String {
190188
let fields = (
@@ -197,6 +195,7 @@ extension AlertState: CustomDebugOutputConvertible {
197195
}
198196
}
199197

198+
@available(iOS 13.0, macOS 10.15, macCatalyst 13, tvOS 13.0, watchOS 6.0, *)
200199
extension AlertState: Equatable where Action: Equatable {
201200
public static func == (lhs: Self, rhs: Self) -> Bool {
202201
lhs.title.formatted() == rhs.title.formatted()
@@ -205,6 +204,8 @@ extension AlertState: Equatable where Action: Equatable {
205204
&& lhs.secondaryButton == rhs.secondaryButton
206205
}
207206
}
207+
208+
@available(iOS 13.0, macOS 10.15, macCatalyst 13, tvOS 13.0, watchOS 6.0, *)
208209
extension AlertState: Hashable where Action: Hashable {
209210
public func hash(into hasher: inout Hasher) {
210211
hasher.combine(self.title.formatted())
@@ -213,8 +214,11 @@ extension AlertState: Hashable where Action: Hashable {
213214
hasher.combine(self.secondaryButton)
214215
}
215216
}
217+
218+
@available(iOS 13.0, macOS 10.15, macCatalyst 13, tvOS 13.0, watchOS 6.0, *)
216219
extension AlertState: Identifiable {}
217220

221+
@available(iOS 13.0, macOS 10.15, macCatalyst 13, tvOS 13.0, watchOS 6.0, *)
218222
extension AlertState.Button.`Type`: Equatable {
219223
public static func == (lhs: Self, rhs: Self) -> Bool {
220224
switch (lhs, rhs) {
@@ -227,12 +231,15 @@ extension AlertState.Button.`Type`: Equatable {
227231
}
228232
}
229233
}
234+
235+
@available(iOS 13.0, macOS 10.15, macCatalyst 13, tvOS 13.0, watchOS 6.0, *)
230236
extension AlertState.Button: Equatable where Action: Equatable {
231237
public static func == (lhs: Self, rhs: Self) -> Bool {
232238
return lhs.action == rhs.action && lhs.type == rhs.type
233239
}
234240
}
235241

242+
@available(iOS 13.0, macOS 10.15, macCatalyst 13, tvOS 13.0, watchOS 6.0, *)
236243
extension AlertState.Button.`Type`: Hashable {
237244
public func hash(into hasher: inout Hasher) {
238245
switch self {
@@ -243,19 +250,17 @@ extension AlertState.Button.`Type`: Hashable {
243250
}
244251
}
245252
}
253+
254+
@available(iOS 13.0, macOS 10.15, macCatalyst 13, tvOS 13.0, watchOS 6.0, *)
246255
extension AlertState.Button: Hashable where Action: Hashable {
247256
public func hash(into hasher: inout Hasher) {
248257
hasher.combine(self.action)
249258
hasher.combine(self.type)
250259
}
251260
}
252261

262+
@available(iOS 13.0, macOS 10.15, macCatalyst 13, tvOS 13.0, watchOS 6.0, *)
253263
extension AlertState.Button {
254-
@available(iOS 13, *)
255-
@available(macCatalyst 13, *)
256-
@available(macOS 10.15, *)
257-
@available(tvOS 13, *)
258-
@available(watchOS 6, *)
259264
func toSwiftUI(send: @escaping (Action) -> Void) -> SwiftUI.Alert.Button {
260265
let action = { if let action = self.action { send(action) } }
261266
switch self.type {
@@ -271,12 +276,8 @@ extension AlertState.Button {
271276
}
272277
}
273278

279+
@available(iOS 13.0, macOS 10.15, macCatalyst 13, tvOS 13.0, watchOS 6.0, *)
274280
extension AlertState {
275-
@available(iOS 13, *)
276-
@available(macCatalyst 13, *)
277-
@available(macOS 10.15, *)
278-
@available(tvOS 13, *)
279-
@available(watchOS 6, *)
280281
fileprivate func toSwiftUI(send: @escaping (Action) -> Void) -> SwiftUI.Alert {
281282
let title = Text(self.title)
282283
let message = self.message.map { Text($0) }

Sources/ComposableArchitecture/TestSupport/TestStore.swift

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -240,20 +240,19 @@
240240
let key = debugCaseOutput(action)
241241
let id = UUID()
242242
return
243-
effects
244-
.handleEvents(
245-
receiveSubscription: { _ in longLivingEffects[key, default: []].insert(id) },
246-
receiveCompletion: { _ in longLivingEffects[key]?.remove(id) },
247-
receiveCancel: { longLivingEffects[key]?.remove(id) }
243+
effects.on(
244+
starting: { longLivingEffects[key, default: []].insert(id) },
245+
completed: { longLivingEffects[key]?.remove(id) },
246+
// terminated: { longLivingEffects[key]?.remove(id) },
247+
disposed: { longLivingEffects[key]?.remove(id) }
248248
)
249249
.map(TestAction.receive)
250-
.eraseToEffect()
251250

252251
},
253252
environment: ()
254253
)
255-
defer { self.state = store.state.value }
256254

255+
defer { self.state = store.$state.value }
257256
let viewStore = ViewStore(
258257
store.scope(state: self.toLocalState, action: TestAction.send)
259258
)
@@ -285,7 +284,6 @@
285284
)
286285
}
287286
}
288-
}
289287

290288
switch step.type {
291289
case let .send(action, update):

Tests/ComposableArchitectureTests/LocalizedStringKeyTests.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import XCTest
33

44
@testable import ComposableArchitecture
55

6+
@available(iOS 13.0, macOS 10.15, macCatalyst 13, tvOS 13.0, watchOS 6.0, *)
67
class LocalizedStringKeyTests: XCTestCase {
78
func testFormatting() {
89
XCTAssertEqual(
@@ -11,6 +12,7 @@ class LocalizedStringKeyTests: XCTestCase {
1112
)
1213

1314
let formatter = NumberFormatter()
15+
formatter.locale = Locale(identifier: "en_US")
1416
formatter.numberStyle = .ordinal
1517
XCTAssertEqual(
1618
LocalizedStringKey("You are \(1_000 as NSNumber, formatter: formatter) in line.").formatted(),

Tests/ComposableArchitectureTests/StoreTests.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ final class StoreTests: XCTestCase {
298298
}
299299

300300
func testActionQueuing() {
301-
let subject = PassthroughSubject<Void, Never>()
301+
let subject = Signal<Void, Never>.pipe()
302302

303303
enum Action: Equatable {
304304
case incrementTapped
@@ -311,11 +311,11 @@ final class StoreTests: XCTestCase {
311311
reducer: Reducer<Int, Action, Void> { state, action, _ in
312312
switch action {
313313
case .incrementTapped:
314-
subject.send()
314+
subject.input.send(value: ())
315315
return .none
316316

317317
case .`init`:
318-
return subject.map { .doIncrement }.eraseToEffect()
318+
return subject.output.producer.map { .doIncrement }
319319

320320
case .doIncrement:
321321
state += 1
@@ -335,7 +335,7 @@ final class StoreTests: XCTestCase {
335335
.receive(.doIncrement) {
336336
$0 = 2
337337
},
338-
.do { subject.send(completion: .finished) }
338+
.do { subject.input.sendCompleted() }
339339
)
340340
}
341341
}

Tests/ComposableArchitectureTests/TestStoreTests.swift

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import Combine
1+
import ReactiveSwift
22
import ComposableArchitecture
33
import XCTest
44

@@ -10,17 +10,15 @@ class TestStoreTests: XCTestCase {
1010
case a, b1, b2, b3, c1, c2, c3, d
1111
}
1212

13-
let testScheduler = DispatchQueue.testScheduler
13+
let testScheduler = TestScheduler()
1414

15-
let reducer = Reducer<State, Action, AnySchedulerOf<DispatchQueue>> { _, action, scheduler in
15+
let reducer = Reducer<State, Action, DateScheduler> { _, action, scheduler in
1616
switch action {
1717
case .a:
1818
return .merge(
1919
Effect.concatenate(.init(value: .b1), .init(value: .c1))
20-
.delay(for: 1, scheduler: scheduler)
21-
.eraseToEffect(),
22-
Empty(completeImmediately: false)
23-
.eraseToEffect()
20+
.delay(1, on: scheduler),
21+
Effect.none
2422
.cancellable(id: 1)
2523
)
2624
case .b1:
@@ -42,13 +40,13 @@ class TestStoreTests: XCTestCase {
4240
let store = TestStore(
4341
initialState: State(),
4442
reducer: reducer,
45-
environment: testScheduler.eraseToAnyScheduler()
43+
environment: testScheduler
4644
)
4745

4846
store.assert(
4947
.send(.a),
5048

51-
.do { testScheduler.advance(by: 1) },
49+
.do { testScheduler.advance(by: .seconds(1)) },
5250

5351
.receive(.b1),
5452
.receive(.b2),

0 commit comments

Comments
 (0)