comparison GeoQuiz/SettingsModalView.swift @ 9:3540c7efc216

implement UserSettings
author Dennis C. M. <dennis@denniscm.com>
date Fri, 07 Oct 2022 18:50:38 +0200
parents d945e52b0704
children a793f33f05fb
comparison
equal deleted inserted replaced
8:e09959b4e4a8 9:3540c7efc216
7 7
8 import SwiftUI 8 import SwiftUI
9 9
10 struct SettingsModalView: View { 10 struct SettingsModalView: View {
11 @Environment(\.dismiss) var dismiss 11 @Environment(\.dismiss) var dismiss
12 @StateObject var user = User()
12 13
13 var body: some View { 14 var body: some View {
14 NavigationView { 15 NavigationView {
15 Form { 16 Form {
16 Section { 17 Section {
17 // Difficulty 18 Picker("Number of lives", selection: $user.settings.numberOfLives) {
19 ForEach(1..<11) { numberOfLives in
20 Text("\(numberOfLives)")
21 .tag(numberOfLives)
22 }
23 }
18 } header: { 24 } header: {
19 Text("Game") 25 Text("Game")
20 } footer: {
21 Text("The harder the difficulty the less lives you get.")
22 } 26 }
23 27
24 Section { 28 Section {
25 // Toggle to disable haptics 29 Toggle("Haptics", isOn: $user.settings.haptics)
26 // Toggle to disable sound effects 30 Toggle("Sound effects", isOn: $user.settings.sound)
27 } header: { 31 } header: {
28 Text("Effects") 32 Text("Effects")
29 } 33 }
30 34
31 Section { 35 Section {
32 // About 36 LinkComponent(
33 // Report bugs 37 color: .mayaBlue,
34 // Twitter 38 iconName: "info.circle.fill",
39 text: "About",
40 url: URL(string: "https://dennistech.io")!
41 )
42
43 LinkComponent(
44 color: .atomicTangerine,
45 iconName: "ant.circle.fill",
46 text: "Report bugs",
47 url: URL(string: "mailto:dmartin@dennistech.io")!
48 )
49
50 LinkComponent(
51 color: .blueBell,
52 iconName: "message.circle.fill",
53 text: "Twitter",
54 url: URL(string: "https://twitter.com/dennistech_")!
55 )
35 } header: { 56 } header: {
36 Text("Get in touch") 57 Text("Get in touch")
37 } 58 }
38 } 59 }
39 .navigationTitle("Settings") 60 .navigationTitle("Settings")