Mercurial > public > geoquiz
view GeoQuiz/SettingsModalView.swift @ 20:e281791e0494
finish implementation
author | Dennis C. M. <dennis@denniscm.com> |
---|---|
date | Sun, 23 Oct 2022 11:48:39 +0100 |
parents | f140bb277c96 |
children | 425078c01194 |
line wrap: on
line source
// // SettingsModalView.swift // GeoQuiz // // Created by Dennis Concepción Martín on 22/9/22. // import SwiftUI struct SettingsModalView: View { @ObservedObject var user: UserController @Environment(\.dismiss) var dismiss var lives: [Int] { var lives = [Int]() for i in stride(from: 5, to: 55, by: 5) { lives.append(i) } return lives } var body: some View { NavigationStack { Form { Section { Picker("❤️ Lives", selection: $user.data.numberOfLives) { ForEach(lives, id: \.self) { numberOfLives in Text("\(numberOfLives)") .tag(numberOfLives) } } } header: { Text("Game") } footer: { Text("Number of lives at the beginning of each game.") } Section { Toggle("Haptics", isOn: $user.data.haptics) Toggle("Sound effects", isOn: $user.data.sound) } header: { Text("Effects") } Section { FormLink( color: .mayaBlue, symbol: "info.circle.fill", text: "About", url: URL(string: "https://dennistech.io")! ) FormLink( color: .atomicTangerine, symbol: "ant.circle.fill", text: "Report bugs", url: URL(string: "mailto:dmartin@dennistech.io")! ) FormLink( color: .blueBell, symbol: "message.circle.fill", text: "Twitter", url: URL(string: "https://twitter.com/dennistech_")! ) } header: { Text("Get in touch") } } .navigationTitle("Settings") .navigationBarTitleDisplayMode(.inline) .toolbar { ToolbarItem(placement: .cancellationAction) { Button { dismiss() } label: { Label("Exit", systemImage: "multiply") } } } } } } struct SettingsModalView_Previews: PreviewProvider { static var previews: some View { SettingsModalView(user: UserController()) } }