Mercurial > public > geoquiz
annotate GeoQuiz/ContentView.swift @ 11:039b26a99a48
implementing RevenueCat
author | Dennis C. M. <dennis@denniscm.com> |
---|---|
date | Sun, 09 Oct 2022 17:02:34 +0200 |
parents | a793f33f05fb |
children | bdfff35dd43c |
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 |
11 | 13 @State private var showingProfileModalView = false |
0 | 14 |
15 var body: some View { | |
16 NavigationView { | |
17 ScrollView(showsIndicators: false) { | |
11 | 18 VStack(alignment: .leading, spacing: 30) { |
10
a793f33f05fb
refactor code and fix layout
Dennis C. M. <dennis@denniscm.com>
parents:
8
diff
changeset
|
19 Text("Select a game 🎮") |
a793f33f05fb
refactor code and fix layout
Dennis C. M. <dennis@denniscm.com>
parents:
8
diff
changeset
|
20 .font(.largeTitle.bold()) |
a793f33f05fb
refactor code and fix layout
Dennis C. M. <dennis@denniscm.com>
parents:
8
diff
changeset
|
21 .padding(.bottom) |
0 | 22 |
7 | 23 NavigationLink(destination: GuessTheFlagView()) { |
0 | 24 GameButton( |
25 gradient: .main, | |
1
259a15f485c5
fix bug with NavigationLink
Dennis C. M. <dennis@denniscm.com>
parents:
0
diff
changeset
|
26 level: "Level 1", symbol: "flag.fill", name: "Guess the flag" |
0 | 27 ) |
28 } | |
29 | |
7 | 30 NavigationLink(destination: GuessTheCapitalView()) { |
0 | 31 GameButton( |
32 gradient: .secondary, | |
1
259a15f485c5
fix bug with NavigationLink
Dennis C. M. <dennis@denniscm.com>
parents:
0
diff
changeset
|
33 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
|
34 ) |
259a15f485c5
fix bug with NavigationLink
Dennis C. M. <dennis@denniscm.com>
parents:
0
diff
changeset
|
35 } |
11 | 36 |
7 | 37 NavigationLink(destination: GuessTheCountryView()) { |
1
259a15f485c5
fix bug with NavigationLink
Dennis C. M. <dennis@denniscm.com>
parents:
0
diff
changeset
|
38 GameButton( |
259a15f485c5
fix bug with NavigationLink
Dennis C. M. <dennis@denniscm.com>
parents:
0
diff
changeset
|
39 gradient: .tertiary, |
259a15f485c5
fix bug with NavigationLink
Dennis C. M. <dennis@denniscm.com>
parents:
0
diff
changeset
|
40 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
|
41 ) |
259a15f485c5
fix bug with NavigationLink
Dennis C. M. <dennis@denniscm.com>
parents:
0
diff
changeset
|
42 } |
10
a793f33f05fb
refactor code and fix layout
Dennis C. M. <dennis@denniscm.com>
parents:
8
diff
changeset
|
43 |
a793f33f05fb
refactor code and fix layout
Dennis C. M. <dennis@denniscm.com>
parents:
8
diff
changeset
|
44 NavigationLink(destination: GuessThePopulationView()) { |
a793f33f05fb
refactor code and fix layout
Dennis C. M. <dennis@denniscm.com>
parents:
8
diff
changeset
|
45 GameButton( |
a793f33f05fb
refactor code and fix layout
Dennis C. M. <dennis@denniscm.com>
parents:
8
diff
changeset
|
46 gradient: .quaternary, |
a793f33f05fb
refactor code and fix layout
Dennis C. M. <dennis@denniscm.com>
parents:
8
diff
changeset
|
47 level: "Level 4", symbol: "person.fill", name: "Guess the population" |
a793f33f05fb
refactor code and fix layout
Dennis C. M. <dennis@denniscm.com>
parents:
8
diff
changeset
|
48 ) |
a793f33f05fb
refactor code and fix layout
Dennis C. M. <dennis@denniscm.com>
parents:
8
diff
changeset
|
49 } |
0 | 50 } |
51 .padding() | |
52 } | |
10
a793f33f05fb
refactor code and fix layout
Dennis C. M. <dennis@denniscm.com>
parents:
8
diff
changeset
|
53 .navigationTitle("GeoQuiz") |
a793f33f05fb
refactor code and fix layout
Dennis C. M. <dennis@denniscm.com>
parents:
8
diff
changeset
|
54 .navigationBarTitleDisplayMode(.inline) |
0 | 55 .toolbar { |
5 | 56 ToolbarItem(placement: .navigationBarLeading) { |
57 Button { | |
58 showingSettingsModalView = true | |
59 } label: { | |
60 Label("Settings", systemImage: "gear") | |
61 } | |
62 } | |
63 | |
64 ToolbarItemGroup { | |
65 Button { | |
7 | 66 showingBuyPremiumModalView = true |
5 | 67 } label: { |
7 | 68 Label("Buy premium", systemImage: "star") |
5 | 69 } |
11 | 70 |
71 Button { | |
72 showingProfileModalView = true | |
73 } label: { | |
74 Label("Profile", systemImage: "person") | |
75 } | |
0 | 76 } |
77 } | |
7 | 78 .sheet(isPresented: $showingBuyPremiumModalView) { |
11 | 79 BuyPremiumModalView() |
0 | 80 } |
5 | 81 |
82 .sheet(isPresented: $showingSettingsModalView) { | |
83 SettingsModalView() | |
84 } | |
11 | 85 |
86 .sheet(isPresented: $showingProfileModalView) { | |
87 ProfileModalView() | |
88 } | |
0 | 89 } |
6 | 90 .navigationViewStyle(StackNavigationViewStyle()) |
0 | 91 } |
92 } | |
93 | |
94 struct ContentView_Previews: PreviewProvider { | |
95 static var previews: some View { | |
96 ContentView() | |
97 } | |
98 } |