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 {
|
|
11 @State private var gameName: GameName? = nil
|
|
12 @State private var showingBuyLivesModal = false
|
|
13
|
|
14 var body: some View {
|
|
15 NavigationView {
|
|
16 ScrollView(showsIndicators: false) {
|
|
17 VStack(spacing: 20) {
|
|
18
|
|
19 NavigationLink(tag: GameName.guessTheFlag, selection: $gameName) {
|
|
20 GuessTheFlagView(gameName: $gameName)
|
|
21 } label: {
|
|
22 GameButton(
|
|
23 gradient: .main,
|
|
24 level: "Level 1", symbol: "globe.americas.fill", name: "Guess the flag"
|
|
25 )
|
|
26 }
|
|
27
|
|
28 NavigationLink(tag: GameName.guessTheCapital, selection: $gameName) {
|
|
29 GuessTheCapitalView(gameName: $gameName)
|
|
30 } label: {
|
|
31 GameButton(
|
|
32 gradient: .secondary,
|
|
33 level: "Level 2", symbol: "globe.americas.fill", name: "Guess the capital"
|
|
34 )
|
|
35 }
|
|
36 }
|
|
37 .padding()
|
|
38 }
|
|
39 .navigationTitle("Select a game 🎮")
|
|
40 .toolbar {
|
|
41 Button {
|
|
42 showingBuyLivesModal = true
|
|
43 } label: {
|
|
44 Label("Buy lives", systemImage: "heart.fill")
|
|
45 }
|
|
46 }
|
|
47 .sheet(isPresented: $showingBuyLivesModal) {
|
|
48 BuyLivesModal()
|
|
49 }
|
|
50 }
|
|
51 }
|
|
52 }
|
|
53
|
|
54 struct ContentView_Previews: PreviewProvider {
|
|
55 static var previews: some View {
|
|
56 ContentView()
|
|
57 }
|
|
58 }
|