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 {
|
|
11 @Environment(\.dismiss) var dismiss
|
9
|
12 @StateObject var user = User()
|
5
|
13
|
|
14 var body: some View {
|
|
15 NavigationView {
|
|
16 Form {
|
7
|
17 Section {
|
9
|
18 Picker("Number of lives", selection: $user.settings.numberOfLives) {
|
|
19 ForEach(1..<11) { numberOfLives in
|
|
20 Text("\(numberOfLives)")
|
|
21 .tag(numberOfLives)
|
|
22 }
|
|
23 }
|
7
|
24 } header: {
|
|
25 Text("Game")
|
|
26 }
|
|
27
|
|
28 Section {
|
9
|
29 Toggle("Haptics", isOn: $user.settings.haptics)
|
|
30 Toggle("Sound effects", isOn: $user.settings.sound)
|
7
|
31 } header: {
|
|
32 Text("Effects")
|
|
33 }
|
|
34
|
|
35 Section {
|
9
|
36 LinkComponent(
|
|
37 color: .mayaBlue,
|
|
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 )
|
7
|
56 } header: {
|
|
57 Text("Get in touch")
|
|
58 }
|
5
|
59 }
|
|
60 .navigationTitle("Settings")
|
|
61 .toolbar {
|
|
62 ToolbarItem(placement: .cancellationAction) {
|
|
63 Button {
|
|
64 dismiss()
|
|
65 } label: {
|
|
66 Label("Exit", systemImage: "multiply")
|
|
67 }
|
|
68 }
|
|
69 }
|
|
70 }
|
|
71 }
|
|
72 }
|
|
73
|
|
74 struct SettingsModalView_Previews: PreviewProvider {
|
|
75 static var previews: some View {
|
|
76 SettingsModalView()
|
|
77 }
|
|
78 }
|