comparison GeoQuiz/ContentView.swift @ 5:f31a61462e7a

add sound effects
author Dennis C. M. <dennis@denniscm.com>
date Sat, 24 Sep 2022 12:02:09 +0100
parents de54f05adb78
children 1946bbfde4af
comparison
equal deleted inserted replaced
4:de54f05adb78 5:f31a61462e7a
7 7
8 import SwiftUI 8 import SwiftUI
9 9
10 struct ContentView: View { 10 struct ContentView: View {
11 @State private var gameName: GameName? = nil 11 @State private var gameName: GameName? = nil
12 @State private var showingBuyLivesModal = false 12 @State private var showingBuyLivesModalView = false
13 @State private var showingSettingsModalView = false
13 14
14 var body: some View { 15 var body: some View {
15 NavigationView { 16 NavigationView {
16 ScrollView(showsIndicators: false) { 17 ScrollView(showsIndicators: false) {
17 VStack(spacing: 20) { 18 VStack(spacing: 20) {
62 } 63 }
63 .padding() 64 .padding()
64 } 65 }
65 .navigationTitle("Select a game 🎮") 66 .navigationTitle("Select a game 🎮")
66 .toolbar { 67 .toolbar {
67 Button { 68 ToolbarItem(placement: .navigationBarLeading) {
68 showingBuyLivesModal = true 69 Button {
69 } label: { 70 showingSettingsModalView = true
70 Label("Buy lives", systemImage: "heart.fill") 71 } label: {
72 Label("Settings", systemImage: "gear")
73 }
74 }
75
76 ToolbarItemGroup {
77 Button {
78 showingBuyLivesModalView = true
79 } label: {
80 Label("Buy lives", systemImage: "heart.fill")
81 }
71 } 82 }
72 } 83 }
73 .sheet(isPresented: $showingBuyLivesModal) { 84 .sheet(isPresented: $showingBuyLivesModalView) {
74 BuyLivesModalView() 85 BuyLivesModalView()
86 }
87
88 .sheet(isPresented: $showingSettingsModalView) {
89 SettingsModalView()
75 } 90 }
76 } 91 }
77 } 92 }
78 } 93 }
79 94