comparison GeoQuiz/SettingsModalView.swift @ 31:9d6dd0e59c22

remove dataset and add new screenshots
author Dennis C. M. <dennis@denniscm.com>
date Fri, 11 Nov 2022 08:59:02 +0100
parents eb23effeede7
children
comparison
equal deleted inserted replaced
30:eb23effeede7 31:9d6dd0e59c22
10 struct SettingsModalView: View { 10 struct SettingsModalView: View {
11 @ObservedObject var userController: UserController 11 @ObservedObject var userController: UserController
12 12
13 @Environment(\.dismiss) var dismiss 13 @Environment(\.dismiss) var dismiss
14 14
15 var lives: [Int] { 15 let viewModel = ViewModel()
16 var lives = [Int]()
17 for i in stride(from: 5, to: 55, by: 5) {
18 lives.append(i)
19 }
20
21 return lives
22 }
23 16
24 var body: some View { 17 var body: some View {
25 NavigationStack { 18 NavigationStack {
26 Form { 19 Form {
27 Section { 20 Section {
28 Picker("❤️ Lives", selection: $userController.data.numberOfLives) { 21 Picker("❤️ Lives", selection: $userController.data.numberOfLives) {
29 ForEach(lives, id: \.self) { numberOfLives in 22 ForEach(viewModel.lives, id: \.self) { numberOfLives in
30 Text("\(numberOfLives)") 23 Text("\(numberOfLives)")
31 .tag(numberOfLives) 24 .tag(numberOfLives)
32 } 25 }
33 } 26 }
34 } header: { 27 } header: {
41 Toggle("Haptics", isOn: $userController.data.haptics) 34 Toggle("Haptics", isOn: $userController.data.haptics)
42 Toggle("Sound effects", isOn: $userController.data.sound) 35 Toggle("Sound effects", isOn: $userController.data.sound)
43 } 36 }
44 37
45 Section { 38 Section {
46 Picker("Flag shape", selection: $userController.data.guessTheFlagShape) { 39 Picker("Flag aspect ratio", selection: $userController.data.guessTheFlagAspectRatio) {
47 ForEach(GuessTheFlagShape.allCases, id: \.self) { shape in 40 ForEach(GuessTheFlagAspectRatio.allCases, id: \.self) { aspectRatio in
48 Text(shape.localizedName) 41 Text(aspectRatio.localizedName)
49 .tag(shape) 42 .tag(aspectRatio)
50 } 43 }
51 } 44 }
52 } header: { 45 } header: {
53 Text("Guess the flag game") 46 Text("Guess the flag game")
54 } 47 }
57 Link(destination: URL(string: "https://dennistech.io")!) { 50 Link(destination: URL(string: "https://dennistech.io")!) {
58 SettingsRow( 51 SettingsRow(
59 color: .mayaBlue, 52 color: .mayaBlue,
60 symbol: "person.fill", 53 symbol: "person.fill",
61 text: "About" 54 text: "About"
62 )
63 }
64
65 NavigationLink(destination: DatasetView()) {
66 SettingsRow(
67 color: .atomicTangerine,
68 symbol: "square.stack.3d.up.fill",
69 text: "Dataset"
70 ) 55 )
71 } 56 }
72 57
73 Link(destination: URL(string: "mailto:dmartin@dennistech.io")!) { 58 Link(destination: URL(string: "mailto:dmartin@dennistech.io")!) {
74 SettingsRow( 59 SettingsRow(
90 Spacer() 75 Spacer()
91 VStack { 76 VStack {
92 Text("© 2022 Dennis Technologies Ltd.") 77 Text("© 2022 Dennis Technologies Ltd.")
93 Text("Proud to be indie.") 78 Text("Proud to be indie.")
94 79
95 if let versionNumber = getVersion() { 80 if let versionNumber = viewModel.getVersion() {
96 Text("Version \(versionNumber)") 81 Text("Version \(versionNumber)")
97 } 82 }
98 } 83 }
99 Spacer() 84 Spacer()
100 } 85 }