Skip to content

Commit dfd613b

Browse files
committed
Multiple changes
1 parent 859cc61 commit dfd613b

File tree

5 files changed

+22
-5
lines changed

5 files changed

+22
-5
lines changed

Moonshot/Moonshot/AstronautView.swift

+18-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ import SwiftUI
99

1010
struct AstronautView: View {
1111
let astronaut: Astronaut
12-
12+
let missions: [Mission]
13+
1314
var body: some View {
1415
GeometryReader { geometry in
1516
ScrollView(.vertical) {
@@ -20,7 +21,12 @@ struct AstronautView: View {
2021
.frame(width: geometry.size.width)
2122

2223
// Challenge 2 ForEach self.mission -- make horizontal scroll view with missions (flight patch + name at bottom)
23-
24+
/* ScrollView(.horizontal) {
25+
ForEach(self.missions) { mission in
26+
MissionListRow(mission: mission, showingNames: false)
27+
}
28+
}*/
29+
2430
Text(self.astronaut.description)
2531
.padding()
2632
.layoutPriority(1)
@@ -29,6 +35,16 @@ struct AstronautView: View {
2935
}
3036
.navigationBarTitle(Text(astronaut.name), displayMode: .inline)
3137
}
38+
init(astronaut: Astronaut) {
39+
self.astronaut = astronaut
40+
41+
let missions: [Mission] = Bundle.main.decode("missions.json")
42+
43+
let matches = missions.filter { mission in
44+
mission.crew.contains(where: { $0.name == astronaut.id })
45+
}
46+
self.missions = matches
47+
}
3248
}
3349

3450
struct AstronautView_Previews: PreviewProvider {

MultiplyBot/MultiplyBot/ContentView.swift

+4-3
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ struct Question {
2222
struct SettingScreen: View {
2323
let questionAlternatives: [String] = ["5", "10", "20", "All"]
2424

25-
@State private var numberOfTables = 1
25+
@State private var numberOfTables = 2
2626
@State private var questionSelection = 1
2727

2828
var body: some View {
@@ -41,7 +41,7 @@ struct SettingScreen: View {
4141
Spacer()
4242

4343
Group {
44-
Stepper(value: $numberOfTables, in: 1...12) {
44+
Stepper(value: $numberOfTables, in: 2...12) {
4545
Text("Tables up to: \(numberOfTables)")
4646
.font(.title3)
4747
.fontWeight(.bold)
@@ -124,6 +124,7 @@ struct GameScreen: View {
124124

125125
Text("what's")
126126
.font(.system(size: 30))
127+
.bold()
127128

128129
Text("")
129130
.font(.system(size: 50))
@@ -162,7 +163,7 @@ struct GameScreen: View {
162163
Spacer()
163164
}
164165
}
165-
.onAppear(perform: { createQuestions(for: tablesReturned) })
166+
// .onAppear(perform: { createQuestions(for: tablesReturned) })
166167
.preferredColorScheme(.light)
167168
}
168169

0 commit comments

Comments
 (0)