Skip to content

Commit 42c71dc

Browse files
Jager-yoop4checo
authored andcommitted
Remove unnecessary dependencies in every CaseStudies (#1503)
* Remove unnecessary dependencies in SwiftUI-CaseStudies * Remove unnecessary dependencies in other-CaseStudies * Add MARK headers to every SwiftUI-CaseStudies (cherry picked from commit 790469d1e5aaa4dd841cc017d4a1ed8a14623e99) # Conflicts: # Examples/CaseStudies/SwiftUICaseStudies/00-Core.swift # Examples/CaseStudies/SwiftUICaseStudies/03-Navigation-Lists-LoadThenNavigate.swift # Examples/CaseStudies/SwiftUICaseStudies/04-HigherOrderReducers-ReusableFavoriting.swift # Examples/VoiceMemos/VoiceMemos/VoiceMemo.swift # Examples/VoiceMemos/VoiceMemos/VoiceMemos.swift # Examples/VoiceMemos/VoiceMemos/VoiceMemosApp.swift
1 parent 3ddc109 commit 42c71dc

File tree

40 files changed

+139
-47
lines changed

40 files changed

+139
-47
lines changed

Examples/CaseStudies/SwiftUICaseStudies/00-Core.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
import ComposableArchitecture
2-
import ReactiveSwift
3-
import XCTestDynamicOverlay
42

53
struct Root: ReducerProtocol {
64
struct State: Equatable {

Examples/CaseStudies/SwiftUICaseStudies/00-RootView.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import Combine
21
import ComposableArchitecture
32
import ReactiveSwift
43
import SwiftUI
@@ -282,6 +281,8 @@ struct RootView: View {
282281
}
283282
}
284283

284+
// MARK: - SwiftUI previews
285+
285286
struct RootView_Previews: PreviewProvider {
286287
static var previews: some View {
287288
RootView(

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ private let readMe = """
1919
alerts and dialogs in your application
2020
"""
2121

22+
// MARK: - Feature domain
23+
2224
struct AlertAndConfirmationDialog: ReducerProtocol {
2325
struct State: Equatable {
2426
var alert: AlertState<Action>?
@@ -79,6 +81,8 @@ struct AlertAndConfirmationDialog: ReducerProtocol {
7981
}
8082
}
8183

84+
// MARK: - Feature view
85+
8286
struct AlertAndConfirmationDialogView: View {
8387
let store: StoreOf<AlertAndConfirmationDialog>
8488

@@ -106,6 +110,8 @@ struct AlertAndConfirmationDialogView: View {
106110
}
107111
}
108112

113+
// MARK: - SwiftUI previews
114+
109115
struct AlertAndConfirmationDialog_Previews: PreviewProvider {
110116
static var previews: some View {
111117
NavigationView {

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ private let readMe = """
1919
toggle at the bottom of the screen.
2020
"""
2121

22+
// MARK: - Feature domain
23+
2224
struct Animations: ReducerProtocol {
2325
struct State: Equatable {
2426
var alert: AlertState<Action>?
@@ -86,6 +88,8 @@ struct Animations: ReducerProtocol {
8688
}
8789
}
8890

91+
// MARK: - Feature view
92+
8993
struct AnimationsView: View {
9094
let store: StoreOf<Animations>
9195

@@ -137,6 +141,8 @@ struct AnimationsView: View {
137141
}
138142
}
139143

144+
// MARK: - SwiftUI previews
145+
140146
struct AnimationsView_Previews: PreviewProvider {
141147
static var previews: some View {
142148
Group {

Examples/CaseStudies/SwiftUICaseStudies/01-GettingStarted-Bindings-Basics.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ private let readMe = """
1818
component changes, which means you can keep using a unidirectional style for your feature.
1919
"""
2020

21+
// MARK: - Feature domain
22+
2123
struct BindingBasics: ReducerProtocol {
2224
struct State: Equatable {
2325
var sliderValue = 5.0
@@ -55,6 +57,8 @@ struct BindingBasics: ReducerProtocol {
5557
}
5658
}
5759

60+
// MARK: - Feature view
61+
5862
struct BindingBasicsView: View {
5963
let store: StoreOf<BindingBasics>
6064

@@ -119,6 +123,8 @@ private func alternate(_ string: String) -> String {
119123
.joined()
120124
}
121125

126+
// MARK: - SwiftUI previews
127+
122128
struct BindingBasicsView_Previews: PreviewProvider {
123129
static var previews: some View {
124130
NavigationView {

Examples/CaseStudies/SwiftUICaseStudies/01-GettingStarted-Bindings-Forms.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ private let readMe = """
1313
It is instructive to compare this case study to the "Binding Basics" case study.
1414
"""
1515

16+
// MARK: - Feature domain
17+
1618
struct BindingForm: ReducerProtocol {
1719
struct State: Equatable {
1820
@BindableState var sliderValue = 5.0
@@ -45,6 +47,8 @@ struct BindingForm: ReducerProtocol {
4547
}
4648
}
4749

50+
// MARK: - Feature view
51+
4852
struct BindingFormView: View {
4953
let store: StoreOf<BindingForm>
5054

@@ -106,6 +110,8 @@ private func alternate(_ string: String) -> String {
106110
.joined()
107111
}
108112

113+
// MARK: - SwiftUI previews
114+
109115
struct BindingFormView_Previews: PreviewProvider {
110116
static var previews: some View {
111117
NavigationView {

Examples/CaseStudies/SwiftUICaseStudies/01-GettingStarted-Composition-TwoCounters.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ private let readMe = """
88
It reuses the the domain of the counter screen and embeds it, twice, in a larger domain.
99
"""
1010

11+
// MARK: - Feature domain
12+
1113
struct TwoCounters: ReducerProtocol {
1214
struct State: Equatable {
1315
var counter1 = Counter.State()
@@ -29,6 +31,8 @@ struct TwoCounters: ReducerProtocol {
2931
}
3032
}
3133

34+
// MARK: - Feature view
35+
3236
struct TwoCountersView: View {
3337
let store: StoreOf<TwoCounters>
3438

@@ -59,6 +63,8 @@ struct TwoCountersView: View {
5963
}
6064
}
6165

66+
// MARK: - SwiftUI previews
67+
6268
struct TwoCountersView_Previews: PreviewProvider {
6369
static var previews: some View {
6470
NavigationView {

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ private let readMe = """
99
state of the application and any actions that can affect that state or the outside world.
1010
"""
1111

12+
// MARK: - Feature domain
13+
1214
struct Counter: ReducerProtocol {
1315
struct State: Equatable {
1416
var count = 0
@@ -31,6 +33,8 @@ struct Counter: ReducerProtocol {
3133
}
3234
}
3335

36+
// MARK: - Feature view
37+
3438
struct CounterView: View {
3539
let store: StoreOf<Counter>
3640

@@ -75,6 +79,8 @@ struct CounterDemoView: View {
7579
}
7680
}
7781

82+
// MARK: - SwiftUI previews
83+
7884
struct CounterView_Previews: PreviewProvider {
7985
static var previews: some View {
8086
NavigationView {

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ private let readMe = """
66
If you tap the "Sign in" button while a field is empty, the focus will be changed to that field.
77
"""
88

9+
// MARK: - Feature domain
10+
911
struct FocusDemo: ReducerProtocol {
1012
struct State: Equatable {
1113
@BindableState var focusedField: Field?
@@ -41,6 +43,8 @@ struct FocusDemo: ReducerProtocol {
4143
}
4244
}
4345

46+
// MARK: - Feature view
47+
4448
struct FocusDemoView: View {
4549
let store: StoreOf<FocusDemo>
4650
@FocusState var focusedField: FocusDemo.State.Field?
@@ -80,6 +84,8 @@ extension View {
8084
}
8185
}
8286

87+
// MARK: - SwiftUI previews
88+
8389
struct FocusDemo_Previews: PreviewProvider {
8490
static var previews: some View {
8591
NavigationView {

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ private let readMe = """
1212
Tapping "Toggle counter state" will flip between the `nil` and non-`nil` counter states.
1313
"""
1414

15+
// MARK: - Feature domain
16+
1517
struct OptionalBasics: ReducerProtocol {
1618
struct State: Equatable {
1719
var optionalCounter: Counter.State?
@@ -41,6 +43,8 @@ struct OptionalBasics: ReducerProtocol {
4143
}
4244
}
4345

46+
// MARK: - Feature view
47+
4448
struct OptionalBasicsView: View {
4549
let store: StoreOf<OptionalBasics>
4650

@@ -76,6 +80,8 @@ struct OptionalBasicsView: View {
7680
}
7781
}
7882

83+
// MARK: - SwiftUI previews
84+
7985
struct OptionalBasicsView_Previews: PreviewProvider {
8086
static var previews: some View {
8187
Group {

0 commit comments

Comments
 (0)