Mercurial > public > geoquiz
annotate GeoQuiz/SettingsModalView.swift @ 25:b3df0f5dc750
remove audio from UIBackgroundModes
author | Dennis C. M. <dennis@denniscm.com> |
---|---|
date | Fri, 28 Oct 2022 18:58:24 +0200 |
parents | e281791e0494 |
children | 425078c01194 |
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 { | |
19 | 11 @ObservedObject var user: UserController |
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 |
a793f33f05fb
refactor code and fix layout
Dennis C. M. <dennis@denniscm.com>
parents:
9
diff
changeset
|
15 var lives: [Int] { |
a793f33f05fb
refactor code and fix layout
Dennis C. M. <dennis@denniscm.com>
parents:
9
diff
changeset
|
16 var lives = [Int]() |
a793f33f05fb
refactor code and fix layout
Dennis C. M. <dennis@denniscm.com>
parents:
9
diff
changeset
|
17 for i in stride(from: 5, to: 55, by: 5) { |
a793f33f05fb
refactor code and fix layout
Dennis C. M. <dennis@denniscm.com>
parents:
9
diff
changeset
|
18 lives.append(i) |
a793f33f05fb
refactor code and fix layout
Dennis C. M. <dennis@denniscm.com>
parents:
9
diff
changeset
|
19 } |
a793f33f05fb
refactor code and fix layout
Dennis C. M. <dennis@denniscm.com>
parents:
9
diff
changeset
|
20 |
a793f33f05fb
refactor code and fix layout
Dennis C. M. <dennis@denniscm.com>
parents:
9
diff
changeset
|
21 return lives |
a793f33f05fb
refactor code and fix layout
Dennis C. M. <dennis@denniscm.com>
parents:
9
diff
changeset
|
22 } |
5 | 23 |
24 var body: some View { | |
19 | 25 NavigationStack { |
5 | 26 Form { |
7 | 27 Section { |
14 | 28 Picker("❤️ Lives", selection: $user.data.numberOfLives) { |
10
a793f33f05fb
refactor code and fix layout
Dennis C. M. <dennis@denniscm.com>
parents:
9
diff
changeset
|
29 ForEach(lives, id: \.self) { numberOfLives in |
9 | 30 Text("\(numberOfLives)") |
31 .tag(numberOfLives) | |
32 } | |
33 } | |
7 | 34 } header: { |
35 Text("Game") | |
10
a793f33f05fb
refactor code and fix layout
Dennis C. M. <dennis@denniscm.com>
parents:
9
diff
changeset
|
36 } footer: { |
a793f33f05fb
refactor code and fix layout
Dennis C. M. <dennis@denniscm.com>
parents:
9
diff
changeset
|
37 Text("Number of lives at the beginning of each game.") |
7 | 38 } |
39 | |
40 Section { | |
14 | 41 Toggle("Haptics", isOn: $user.data.haptics) |
42 Toggle("Sound effects", isOn: $user.data.sound) | |
7 | 43 } header: { |
44 Text("Effects") | |
45 } | |
46 | |
47 Section { | |
20 | 48 FormLink( |
9 | 49 color: .mayaBlue, |
19 | 50 symbol: "info.circle.fill", |
9 | 51 text: "About", |
52 url: URL(string: "https://dennistech.io")! | |
53 ) | |
54 | |
20 | 55 FormLink( |
9 | 56 color: .atomicTangerine, |
19 | 57 symbol: "ant.circle.fill", |
9 | 58 text: "Report bugs", |
59 url: URL(string: "mailto:dmartin@dennistech.io")! | |
60 ) | |
61 | |
20 | 62 FormLink( |
9 | 63 color: .blueBell, |
19 | 64 symbol: "message.circle.fill", |
9 | 65 text: "Twitter", |
66 url: URL(string: "https://twitter.com/dennistech_")! | |
67 ) | |
7 | 68 } header: { |
69 Text("Get in touch") | |
70 } | |
5 | 71 } |
72 .navigationTitle("Settings") | |
19 | 73 .navigationBarTitleDisplayMode(.inline) |
5 | 74 .toolbar { |
75 ToolbarItem(placement: .cancellationAction) { | |
76 Button { | |
77 dismiss() | |
78 } label: { | |
79 Label("Exit", systemImage: "multiply") | |
80 } | |
81 } | |
82 } | |
83 } | |
84 } | |
85 } | |
86 | |
87 struct SettingsModalView_Previews: PreviewProvider { | |
88 static var previews: some View { | |
19 | 89 SettingsModalView(user: UserController()) |
5 | 90 } |
91 } |