Skip to content

Commit 4328951

Browse files
Added file and line to optional assert (#218)
* Added file and line to optional assert * Apply suggestions from code review Co-authored-by: Stephen Celis <[email protected]> * Deprecate old optional property and migrated TicTacToe example * Migrated other examples to optional() and added file/line to forEach * Update Deprecations.swift Co-authored-by: Stephen Celis <[email protected]>
1 parent 27fd942 commit 4328951

14 files changed

+68
-33
lines changed

Examples/CaseStudies/SwiftUICaseStudies/01-GettingStarted-OptionalState.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@ enum OptionalBasicsAction: Equatable {
2323

2424
struct OptionalBasicsEnvironment {}
2525

26-
let optionalBasicsReducer = counterReducer
27-
.optional
26+
let optionalBasicsReducer =
27+
counterReducer
28+
.optional()
2829
.pullback(
2930
state: \.optionalCounter,
3031
action: /OptionalBasicsAction.optionalCounter,

Examples/CaseStudies/SwiftUICaseStudies/03-Navigation-Lists-LoadThenNavigate.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ let loadThenNavigateListReducer =
4242
action: .self,
4343
environment: { $0 }
4444
)
45-
.optional
45+
.optional()
4646
.pullback(
4747
state: \LoadThenNavigateListState.selection,
4848
action: /LoadThenNavigateListAction.counter,

Examples/CaseStudies/SwiftUICaseStudies/03-Navigation-Lists-NavigateAndLoad.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,11 @@ struct NavigateAndLoadListEnvironment {
3333
var mainQueue: DateScheduler
3434
}
3535

36-
let navigateAndLoadListReducer = counterReducer
37-
.optional
36+
let navigateAndLoadListReducer =
37+
counterReducer
38+
.optional()
3839
.pullback(state: \Identified.value, action: .self, environment: { $0 })
39-
.optional
40+
.optional()
4041
.pullback(
4142
state: \NavigateAndLoadListState.selection,
4243
action: /NavigateAndLoadListAction.counter,

Examples/CaseStudies/SwiftUICaseStudies/03-Navigation-LoadThenNavigate.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,9 @@ struct LoadThenNavigateEnvironment {
2727
var mainQueue: DateScheduler
2828
}
2929

30-
let loadThenNavigateReducer = counterReducer
31-
.optional
30+
let loadThenNavigateReducer =
31+
counterReducer
32+
.optional()
3233
.pullback(
3334
state: \.optionalCounter,
3435
action: /LoadThenNavigateAction.optionalCounter,

Examples/CaseStudies/SwiftUICaseStudies/03-Navigation-NavigateAndLoad.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@ struct NavigateAndLoadEnvironment {
2626
var mainQueue: DateScheduler
2727
}
2828

29-
let navigateAndLoadReducer = counterReducer
30-
.optional
29+
let navigateAndLoadReducer =
30+
counterReducer
31+
.optional()
3132
.pullback(
3233
state: \.optionalCounter,
3334
action: /NavigateAndLoadAction.optionalCounter,

Examples/CaseStudies/SwiftUICaseStudies/03-Navigation-Sheet-LoadThenPresent.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,9 @@ struct LoadThenPresentEnvironment {
2727
var mainQueue: DateScheduler
2828
}
2929

30-
let loadThenPresentReducer = counterReducer
31-
.optional
30+
let loadThenPresentReducer =
31+
counterReducer
32+
.optional()
3233
.pullback(
3334
state: \.optionalCounter,
3435
action: /LoadThenPresentAction.optionalCounter,

Examples/CaseStudies/SwiftUICaseStudies/03-Navigation-Sheet-PresentAndLoad.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@ struct PresentAndLoadEnvironment {
2424
var mainQueue: DateScheduler
2525
}
2626

27-
let presentAndLoadReducer = counterReducer
28-
.optional
27+
let presentAndLoadReducer =
28+
counterReducer
29+
.optional()
2930
.pullback(
3031
state: \.optionalCounter,
3132
action: /PresentAndLoadAction.optionalCounter,

Examples/CaseStudies/UIKitCaseStudies/LoadThenNavigate.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@ struct LazyNavigationEnvironment {
1818
var mainQueue: DateScheduler
1919
}
2020

21-
let lazyNavigationReducer = counterReducer
22-
.optional
21+
let lazyNavigationReducer =
22+
counterReducer
23+
.optional()
2324
.pullback(
2425
state: \.optionalCounter,
2526
action: /LazyNavigationAction.optionalCounter,

Examples/CaseStudies/UIKitCaseStudies/NavigateAndLoad.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@ struct EagerNavigationEnvironment {
1818
var mainQueue: DateScheduler
1919
}
2020

21-
let eagerNavigationReducer = counterReducer
22-
.optional
21+
let eagerNavigationReducer =
22+
counterReducer
23+
.optional()
2324
.pullback(
2425
state: \.optionalCounter,
2526
action: /EagerNavigationAction.optionalCounter,

Examples/TicTacToe/Sources/Core/AppCore.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public struct AppEnvironment {
3131
}
3232

3333
public let appReducer = Reducer<AppState, AppAction, AppEnvironment>.combine(
34-
loginReducer.optional.pullback(
34+
loginReducer.optional().pullback(
3535
state: \.login,
3636
action: /AppAction.login,
3737
environment: {
@@ -41,7 +41,7 @@ public let appReducer = Reducer<AppState, AppAction, AppEnvironment>.combine(
4141
)
4242
}
4343
),
44-
newGameReducer.optional.pullback(
44+
newGameReducer.optional().pullback(
4545
state: \.newGame,
4646
action: /AppAction.newGame,
4747
environment: { _ in NewGameEnvironment() }

0 commit comments

Comments
 (0)