Skip to content

Commit 63260c6

Browse files
committed
Further Modernize Demos (#914)
* Modernize Demos * wip
1 parent 49a25c4 commit 63260c6

File tree

47 files changed

+210
-115
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+210
-115
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ jobs:
1616
xcode:
1717
- '12.4'
1818
- '12.5.1'
19-
- '13.1'
19+
- '13.2'
2020
steps:
2121
- uses: actions/checkout@v2
2222
- name: Select Xcode ${{ matrix.xcode }}
2323
run: sudo xcode-select -s /Applications/Xcode_${{ matrix.xcode }}.app
2424
- name: Run tests
2525
run: make test-library
2626
# - name: Compile documentation
27-
# if: ${{ matrix.xcode == '13.1' }}
27+
# if: ${{ matrix.xcode == '13.2' }}
2828
# run: make test-docs
2929
- name: Run benchmark
3030
run: make benchmark
@@ -34,9 +34,7 @@ jobs:
3434
strategy:
3535
matrix:
3636
xcode:
37-
- '12.4'
38-
- '12.5.1'
39-
- '13.1'
37+
- '13.2'
4038
steps:
4139
- uses: actions/checkout@v2
4240
- name: Select Xcode ${{ matrix.xcode }}
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Scheme
3+
LastUpgradeVersion = "1320"
4+
version = "1.3">
5+
<BuildAction
6+
parallelizeBuildables = "YES"
7+
buildImplicitDependencies = "YES">
8+
<BuildActionEntries>
9+
<BuildActionEntry
10+
buildForTesting = "YES"
11+
buildForRunning = "YES"
12+
buildForProfiling = "YES"
13+
buildForArchiving = "YES"
14+
buildForAnalyzing = "YES">
15+
<BuildableReference
16+
BuildableIdentifier = "primary"
17+
BlueprintIdentifier = "CAF88E6F24B8E26D00539345"
18+
BuildableName = "tvOSCaseStudies.app"
19+
BlueprintName = "tvOSCaseStudies"
20+
ReferencedContainer = "container:CaseStudies.xcodeproj">
21+
</BuildableReference>
22+
</BuildActionEntry>
23+
</BuildActionEntries>
24+
</BuildAction>
25+
<TestAction
26+
buildConfiguration = "Debug"
27+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
28+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29+
shouldUseLaunchSchemeArgsEnv = "YES">
30+
<Testables>
31+
<TestableReference
32+
skipped = "NO">
33+
<BuildableReference
34+
BuildableIdentifier = "primary"
35+
BlueprintIdentifier = "CAF88E8224B8E26E00539345"
36+
BuildableName = "tvOSCaseStudiesTests.xctest"
37+
BlueprintName = "tvOSCaseStudiesTests"
38+
ReferencedContainer = "container:CaseStudies.xcodeproj">
39+
</BuildableReference>
40+
</TestableReference>
41+
</Testables>
42+
</TestAction>
43+
<LaunchAction
44+
buildConfiguration = "Debug"
45+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
46+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
47+
launchStyle = "0"
48+
useCustomWorkingDirectory = "NO"
49+
ignoresPersistentStateOnLaunch = "NO"
50+
debugDocumentVersioning = "YES"
51+
debugServiceExtension = "internal"
52+
allowLocationSimulation = "YES">
53+
<BuildableProductRunnable
54+
runnableDebuggingMode = "0">
55+
<BuildableReference
56+
BuildableIdentifier = "primary"
57+
BlueprintIdentifier = "CAF88E6F24B8E26D00539345"
58+
BuildableName = "tvOSCaseStudies.app"
59+
BlueprintName = "tvOSCaseStudies"
60+
ReferencedContainer = "container:CaseStudies.xcodeproj">
61+
</BuildableReference>
62+
</BuildableProductRunnable>
63+
</LaunchAction>
64+
<ProfileAction
65+
buildConfiguration = "Release"
66+
shouldUseLaunchSchemeArgsEnv = "YES"
67+
savedToolIdentifier = ""
68+
useCustomWorkingDirectory = "NO"
69+
debugDocumentVersioning = "YES">
70+
<BuildableProductRunnable
71+
runnableDebuggingMode = "0">
72+
<BuildableReference
73+
BuildableIdentifier = "primary"
74+
BlueprintIdentifier = "CAF88E6F24B8E26D00539345"
75+
BuildableName = "tvOSCaseStudies.app"
76+
BlueprintName = "tvOSCaseStudies"
77+
ReferencedContainer = "container:CaseStudies.xcodeproj">
78+
</BuildableReference>
79+
</BuildableProductRunnable>
80+
</ProfileAction>
81+
<AnalyzeAction
82+
buildConfiguration = "Debug">
83+
</AnalyzeAction>
84+
<ArchiveAction
85+
buildConfiguration = "Release"
86+
revealArchiveInOrganizer = "YES">
87+
</ArchiveAction>
88+
</Scheme>

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,9 @@ struct AnimationsView: View {
143143
)
144144
.padding()
145145
Button("Rainbow") { viewStore.send(.rainbowButtonTapped, animation: .linear) }
146-
.padding([.leading, .trailing, .bottom])
146+
.padding([.horizontal, .bottom])
147147
Button("Reset") { viewStore.send(.resetButtonTapped) }
148-
.padding([.leading, .trailing, .bottom])
148+
.padding([.horizontal, .bottom])
149149
}
150150
.alert(self.store.scope(state: \.alert), dismiss: .dismissAlert)
151151
}

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ struct BindingBasicsState: Equatable {
2929
enum BindingBasicsAction {
3030
case sliderValueChanged(Double)
3131
case stepCountChanged(Int)
32-
case textChange(String)
33-
case toggleChange(isOn: Bool)
32+
case textChanged(String)
33+
case toggleChanged(isOn: Bool)
3434
}
3535

3636
struct BindingBasicsEnvironment {}
@@ -49,11 +49,11 @@ let bindingBasicsReducer = Reducer<
4949
state.stepCount = count
5050
return .none
5151

52-
case let .textChange(text):
52+
case let .textChanged(text):
5353
state.text = text
5454
return .none
5555

56-
case let .toggleChange(isOn):
56+
case let .toggleChanged(isOn):
5757
state.toggleIsOn = isOn
5858
return .none
5959
}
@@ -69,7 +69,7 @@ struct BindingBasicsView: View {
6969
HStack {
7070
TextField(
7171
"Type here",
72-
text: viewStore.binding(get: \.text, send: BindingBasicsAction.textChange)
72+
text: viewStore.binding(get: \.text, send: BindingBasicsAction.textChanged)
7373
)
7474
.disableAutocorrection(true)
7575
.foregroundColor(viewStore.toggleIsOn ? .gray : .primary)
@@ -78,7 +78,7 @@ struct BindingBasicsView: View {
7878
.disabled(viewStore.toggleIsOn)
7979

8080
Toggle(
81-
isOn: viewStore.binding(get: \.toggleIsOn, send: BindingBasicsAction.toggleChange)
81+
isOn: viewStore.binding(get: \.toggleIsOn, send: BindingBasicsAction.toggleChanged)
8282
) {
8383
Text("Disable other controls")
8484
}
@@ -89,13 +89,13 @@ struct BindingBasicsView: View {
8989
in: 0...100
9090
) {
9191
Text("Max slider value: \(viewStore.stepCount)")
92-
.font(Font.body.monospacedDigit())
92+
.font(.body.monospacedDigit())
9393
}
9494
.disabled(viewStore.toggleIsOn)
9595

9696
HStack {
9797
Text("Slider value: \(Int(viewStore.sliderValue))")
98-
.font(Font.body.monospacedDigit())
98+
.font(.body.monospacedDigit())
9999
Slider(
100100
value: viewStore.binding(
101101
get: \.sliderValue,

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,13 @@
6868

6969
Stepper(value: viewStore.binding(\.$stepCount), in: 0...100) {
7070
Text("Max slider value: \(viewStore.stepCount)")
71-
.font(Font.body.monospacedDigit())
71+
.font(.body.monospacedDigit())
7272
}
7373
.disabled(viewStore.toggleIsOn)
7474

7575
HStack {
7676
Text("Slider value: \(Int(viewStore.sliderValue))")
77-
.font(Font.body.monospacedDigit())
77+
.font(.body.monospacedDigit())
7878

7979
Slider(value: viewStore.binding(\.$sliderValue), in: 0...Double(viewStore.stepCount))
8080
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ struct TwoCountersView: View {
4646
CounterView(
4747
store: self.store.scope(state: \.counter1, action: TwoCountersAction.counter1)
4848
)
49-
.buttonStyle(BorderlessButtonStyle())
49+
.buttonStyle(.borderless)
5050
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .trailing)
5151
}
5252
HStack {
@@ -55,7 +55,7 @@ struct TwoCountersView: View {
5555
CounterView(
5656
store: self.store.scope(state: \.counter2, action: TwoCountersAction.counter2)
5757
)
58-
.buttonStyle(BorderlessButtonStyle())
58+
.buttonStyle(.borderless)
5959
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .trailing)
6060
}
6161
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ struct CounterView: View {
3939
HStack {
4040
Button("") { viewStore.send(.decrementButtonTapped) }
4141
Text("\(viewStore.count)")
42-
.font(Font.body.monospacedDigit())
42+
.font(.body.monospacedDigit())
4343
Button("+") { viewStore.send(.incrementButtonTapped) }
4444
}
4545
}
@@ -53,7 +53,7 @@ struct CounterDemoView: View {
5353
Form {
5454
Section(header: Text(readMe)) {
5555
CounterView(store: self.store)
56-
.buttonStyle(BorderlessButtonStyle())
56+
.buttonStyle(.borderless)
5757
.frame(maxWidth: .infinity, maxHeight: .infinity)
5858
}
5959
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ struct OptionalBasicsView: View {
6868
VStack(alignment: .leading, spacing: 16) {
6969
Text(template: "`CounterState` is non-`nil`", .body)
7070
CounterView(store: store)
71-
.buttonStyle(BorderlessButtonStyle())
71+
.buttonStyle(.borderless)
7272
}
7373
},
7474
else: {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ struct SharedStateView: View {
162162
Text("Profile")
163163
.tag(SharedState.Tab.profile)
164164
}
165-
.pickerStyle(SegmentedPickerStyle())
165+
.pickerStyle(.segmented)
166166

167167
if viewStore.state == .counter {
168168
SharedStateCounterView(
@@ -194,7 +194,7 @@ struct SharedStateCounterView: View {
194194
Button("") { viewStore.send(.decrementButtonTapped) }
195195

196196
Text("\(viewStore.count)")
197-
.font(Font.body.monospacedDigit())
197+
.font(.body.monospacedDigit())
198198

199199
Button("+") { viewStore.send(.incrementButtonTapped) }
200200
}

Examples/CaseStudies/SwiftUICaseStudies/02-Effects-Basics.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,11 @@ struct EffectsBasicsView: View {
103103
Spacer()
104104
Button("") { viewStore.send(.decrementButtonTapped) }
105105
Text("\(viewStore.count)")
106-
.font(Font.body.monospacedDigit())
106+
.font(.body.monospacedDigit())
107107
Button("+") { viewStore.send(.incrementButtonTapped) }
108108
Spacer()
109109
}
110-
.buttonStyle(BorderlessButtonStyle())
110+
.buttonStyle(.borderless)
111111

112112
Button("Number fact") { viewStore.send(.numberFactButtonTapped) }
113113
if viewStore.isNumberFactRequestInFlight {

0 commit comments

Comments
 (0)