comparison GeoQuiz/ContentView.swift @ 0:413e2d21333e

first commit
author Dennis C. M. <dennis@denniscm.com>
date Tue, 20 Sep 2022 08:13:26 +0200
parents
children 259a15f485c5
comparison
equal deleted inserted replaced
-1:000000000000 0:413e2d21333e
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 }