Mercurial > public > geoquiz
annotate GeoQuiz/SettingsModalView.swift @ 37:9dd1dce5d05c
Add link to App Store
author | Dennis <dennis@denniscm.com> |
---|---|
date | Fri, 11 Aug 2023 17:28:30 +0000 |
parents | 9d6dd0e59c22 |
children |
rev | line source |
---|---|
5 | 1 // |
2 // SettingsModalView.swift | |
3 // GeoQuiz | |
4 // | |
5 // Created by Dennis Concepción Martín on 22/9/22. | |
6 // | |
7 | |
8 import SwiftUI | |
9 | |
10 struct SettingsModalView: View { | |
26 | 11 @ObservedObject var userController: UserController |
19 | 12 |
5 | 13 @Environment(\.dismiss) var dismiss |
10
a793f33f05fb
refactor code and fix layout
Dennis C. M. <dennis@denniscm.com>
parents:
9
diff
changeset
|
14 |
31
9d6dd0e59c22
remove dataset and add new screenshots
Dennis C. M. <dennis@denniscm.com>
parents:
30
diff
changeset
|
15 let viewModel = ViewModel() |
5 | 16 |
17 var body: some View { | |
19 | 18 NavigationStack { |
5 | 19 Form { |
7 | 20 Section { |
26 | 21 Picker("❤️ Lives", selection: $userController.data.numberOfLives) { |
31
9d6dd0e59c22
remove dataset and add new screenshots
Dennis C. M. <dennis@denniscm.com>
parents:
30
diff
changeset
|
22 ForEach(viewModel.lives, id: \.self) { numberOfLives in |
9 | 23 Text("\(numberOfLives)") |
24 .tag(numberOfLives) | |
25 } | |
26 } | |
7 | 27 } header: { |
27 | 28 Text("General") |
10
a793f33f05fb
refactor code and fix layout
Dennis C. M. <dennis@denniscm.com>
parents:
9
diff
changeset
|
29 } footer: { |
a793f33f05fb
refactor code and fix layout
Dennis C. M. <dennis@denniscm.com>
parents:
9
diff
changeset
|
30 Text("Number of lives at the beginning of each game.") |
7 | 31 } |
32 | |
33 Section { | |
30 | 34 Toggle("Haptics", isOn: $userController.data.haptics) |
35 Toggle("Sound effects", isOn: $userController.data.sound) | |
36 } | |
37 | |
38 Section { | |
31
9d6dd0e59c22
remove dataset and add new screenshots
Dennis C. M. <dennis@denniscm.com>
parents:
30
diff
changeset
|
39 Picker("Flag aspect ratio", selection: $userController.data.guessTheFlagAspectRatio) { |
9d6dd0e59c22
remove dataset and add new screenshots
Dennis C. M. <dennis@denniscm.com>
parents:
30
diff
changeset
|
40 ForEach(GuessTheFlagAspectRatio.allCases, id: \.self) { aspectRatio in |
9d6dd0e59c22
remove dataset and add new screenshots
Dennis C. M. <dennis@denniscm.com>
parents:
30
diff
changeset
|
41 Text(aspectRatio.localizedName) |
9d6dd0e59c22
remove dataset and add new screenshots
Dennis C. M. <dennis@denniscm.com>
parents:
30
diff
changeset
|
42 .tag(aspectRatio) |
27 | 43 } |
44 } | |
45 } header: { | |
46 Text("Guess the flag game") | |
47 } | |
48 | |
49 Section { | |
30 | 50 Link(destination: URL(string: "https://dennistech.io")!) { |
51 SettingsRow( | |
52 color: .mayaBlue, | |
53 symbol: "person.fill", | |
54 text: "About" | |
55 ) | |
56 } | |
57 | |
58 Link(destination: URL(string: "mailto:dmartin@dennistech.io")!) { | |
59 SettingsRow( | |
60 color: .chinaPink, | |
61 symbol: "ant.fill", | |
62 text: "Report bugs" | |
63 ) | |
64 } | |
9 | 65 |
30 | 66 Link(destination: URL(string: "https://twitter.com/dennistech_")!) { |
67 SettingsRow( | |
68 color: .blueBell, | |
69 symbol: "message.fill", | |
70 text: "Twitter" | |
71 ) | |
72 } | |
27 | 73 } footer: { |
74 HStack { | |
75 Spacer() | |
76 VStack { | |
77 Text("© 2022 Dennis Technologies Ltd.") | |
78 Text("Proud to be indie.") | |
79 | |
31
9d6dd0e59c22
remove dataset and add new screenshots
Dennis C. M. <dennis@denniscm.com>
parents:
30
diff
changeset
|
80 if let versionNumber = viewModel.getVersion() { |
27 | 81 Text("Version \(versionNumber)") |
82 } | |
83 } | |
84 Spacer() | |
85 } | |
86 .padding(.top) | |
7 | 87 } |
5 | 88 } |
89 .navigationTitle("Settings") | |
19 | 90 .navigationBarTitleDisplayMode(.inline) |
5 | 91 .toolbar { |
92 ToolbarItem(placement: .cancellationAction) { | |
93 Button { | |
94 dismiss() | |
95 } label: { | |
96 Label("Exit", systemImage: "multiply") | |
97 } | |
98 } | |
99 } | |
100 } | |
101 } | |
102 } | |
103 | |
104 struct SettingsModalView_Previews: PreviewProvider { | |
105 static var previews: some View { | |
26 | 106 SettingsModalView(userController: UserController()) |
5 | 107 } |
108 } |