Mercurial > public > geoquiz
annotate GeoQuiz/ContentView.swift @ 8:e09959b4e4a8
fix bugs
author | Dennis C. M. <dennis@denniscm.com> |
---|---|
date | Thu, 06 Oct 2022 11:14:34 +0200 |
parents | d945e52b0704 |
children | a793f33f05fb |
rev | line source |
---|---|
0 | 1 // |
2 // ContentView.swift | |
3 // GeoQuiz | |
4 // | |
5 // Created by Dennis Concepción Martín on 5/9/22. | |
6 // | |
7 | |
8 import SwiftUI | |
9 | |
10 struct ContentView: View { | |
7 | 11 @State private var showingBuyPremiumModalView = false |
5 | 12 @State private var showingSettingsModalView = false |
0 | 13 |
14 var body: some View { | |
15 NavigationView { | |
16 ScrollView(showsIndicators: false) { | |
17 VStack(spacing: 20) { | |
18 | |
7 | 19 NavigationLink(destination: GuessTheFlagView()) { |
0 | 20 GameButton( |
21 gradient: .main, | |
1
259a15f485c5
fix bug with NavigationLink
Dennis C. M. <dennis@denniscm.com>
parents:
0
diff
changeset
|
22 level: "Level 1", symbol: "flag.fill", name: "Guess the flag" |
0 | 23 ) |
24 } | |
25 | |
7 | 26 NavigationLink(destination: GuessTheCapitalView()) { |
0 | 27 GameButton( |
28 gradient: .secondary, | |
1
259a15f485c5
fix bug with NavigationLink
Dennis C. M. <dennis@denniscm.com>
parents:
0
diff
changeset
|
29 level: "Level 2", symbol: "building.2.fill", name: "Guess the capital" |
259a15f485c5
fix bug with NavigationLink
Dennis C. M. <dennis@denniscm.com>
parents:
0
diff
changeset
|
30 ) |
259a15f485c5
fix bug with NavigationLink
Dennis C. M. <dennis@denniscm.com>
parents:
0
diff
changeset
|
31 } |
6 | 32 |
7 | 33 NavigationLink(destination: GuessTheCountryView()) { |
1
259a15f485c5
fix bug with NavigationLink
Dennis C. M. <dennis@denniscm.com>
parents:
0
diff
changeset
|
34 GameButton( |
259a15f485c5
fix bug with NavigationLink
Dennis C. M. <dennis@denniscm.com>
parents:
0
diff
changeset
|
35 gradient: .tertiary, |
259a15f485c5
fix bug with NavigationLink
Dennis C. M. <dennis@denniscm.com>
parents:
0
diff
changeset
|
36 level: "Level 3", symbol: "globe.americas.fill", name: "Guess the country" |
259a15f485c5
fix bug with NavigationLink
Dennis C. M. <dennis@denniscm.com>
parents:
0
diff
changeset
|
37 ) |
259a15f485c5
fix bug with NavigationLink
Dennis C. M. <dennis@denniscm.com>
parents:
0
diff
changeset
|
38 } |
8 | 39 |
6 | 40 // NavigationLink( |
41 // destination: Text("Guess the population"), | |
42 // tag: GameName.guessThePopulation, | |
43 // selection: $gameName | |
44 // ) { | |
45 // GameButton( | |
46 // gradient: .quaternary, | |
47 // level: "Level 4", symbol: "person.3.fill", name: "Guess the population" | |
48 // ) | |
49 // } | |
0 | 50 } |
51 .padding() | |
52 } | |
53 .navigationTitle("Select a game 🎮") | |
54 .toolbar { | |
5 | 55 ToolbarItem(placement: .navigationBarLeading) { |
56 Button { | |
57 showingSettingsModalView = true | |
58 } label: { | |
59 Label("Settings", systemImage: "gear") | |
60 } | |
61 } | |
62 | |
63 ToolbarItemGroup { | |
64 Button { | |
7 | 65 showingBuyPremiumModalView = true |
5 | 66 } label: { |
7 | 67 Label("Buy premium", systemImage: "star") |
5 | 68 } |
0 | 69 } |
70 } | |
7 | 71 .sheet(isPresented: $showingBuyPremiumModalView) { |
72 Text("Buy premium") | |
0 | 73 } |
5 | 74 |
75 .sheet(isPresented: $showingSettingsModalView) { | |
76 SettingsModalView() | |
77 } | |
0 | 78 } |
6 | 79 .navigationViewStyle(StackNavigationViewStyle()) |
0 | 80 } |
81 } | |
82 | |
83 struct ContentView_Previews: PreviewProvider { | |
84 static var previews: some View { | |
85 ContentView() | |
86 } | |
87 } |