comparison GeoQuiz/ContentView.swift @ 7:d945e52b0704

implement dynamic map
author Dennis C. M. <dennis@denniscm.com>
date Tue, 04 Oct 2022 18:54:24 +0200
parents 1946bbfde4af
children e09959b4e4a8
comparison
equal deleted inserted replaced
6:1946bbfde4af 7:d945e52b0704
6 // 6 //
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 showingBuyPremiumModalView = false
12 @State private var showingBuyLivesModalView = false
13 @State private var showingSettingsModalView = false 12 @State private var showingSettingsModalView = false
14 13
15 var body: some View { 14 var body: some View {
16 NavigationView { 15 NavigationView {
17 ScrollView(showsIndicators: false) { 16 ScrollView(showsIndicators: false) {
18 VStack(spacing: 20) { 17 VStack(spacing: 20) {
19 18
20 NavigationLink( 19 NavigationLink(destination: GuessTheFlagView()) {
21 destination: GuessTheFlagView(gameName: $gameName),
22 tag: GameName.guessTheFlag,
23 selection: $gameName
24 ) {
25 GameButton( 20 GameButton(
26 gradient: .main, 21 gradient: .main,
27 level: "Level 1", symbol: "flag.fill", name: "Guess the flag" 22 level: "Level 1", symbol: "flag.fill", name: "Guess the flag"
28 ) 23 )
29 } 24 }
30 25
31 NavigationLink( 26 NavigationLink(destination: GuessTheCapitalView()) {
32 destination: GuessTheCapitalView(gameName: $gameName),
33 tag: GameName.guessTheCapital,
34 selection: $gameName
35 ) {
36 GameButton( 27 GameButton(
37 gradient: .secondary, 28 gradient: .secondary,
38 level: "Level 2", symbol: "building.2.fill", name: "Guess the capital" 29 level: "Level 2", symbol: "building.2.fill", name: "Guess the capital"
39 ) 30 )
40 } 31 }
41 32
42 NavigationLink( 33 NavigationLink(destination: GuessTheCountryView()) {
43 destination: GuessTheCountryView(gameName: $gameName),
44 tag: GameName.guessTheCountry,
45 selection: $gameName
46 ) {
47 GameButton( 34 GameButton(
48 gradient: .tertiary, 35 gradient: .tertiary,
49 level: "Level 3", symbol: "globe.americas.fill", name: "Guess the country" 36 level: "Level 3", symbol: "globe.americas.fill", name: "Guess the country"
50 ) 37 )
51 } 38 }
73 } 60 }
74 } 61 }
75 62
76 ToolbarItemGroup { 63 ToolbarItemGroup {
77 Button { 64 Button {
78 showingBuyLivesModalView = true 65 showingBuyPremiumModalView = true
79 } label: { 66 } label: {
80 Label("Buy lives", systemImage: "heart.fill") 67 Label("Buy premium", systemImage: "star")
81 } 68 }
82 } 69 }
83 } 70 }
84 .sheet(isPresented: $showingBuyLivesModalView) { 71 .sheet(isPresented: $showingBuyPremiumModalView) {
85 BuyLivesModalView() 72 Text("Buy premium")
86 } 73 }
87 74
88 .sheet(isPresented: $showingSettingsModalView) { 75 .sheet(isPresented: $showingSettingsModalView) {
89 SettingsModalView() 76 SettingsModalView()
90 } 77 }