diff 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
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/GeoQuiz/ContentView.swift	Tue Sep 20 08:13:26 2022 +0200
@@ -0,0 +1,58 @@
+//
+//  ContentView.swift
+//  GeoQuiz
+//
+//  Created by Dennis Concepción Martín on 5/9/22.
+//
+
+import SwiftUI
+
+struct ContentView: View {
+    @State private var gameName: GameName? = nil
+    @State private var showingBuyLivesModal = false
+    
+    var body: some View {
+        NavigationView {
+            ScrollView(showsIndicators: false) {
+                VStack(spacing: 20) {
+                    
+                    NavigationLink(tag: GameName.guessTheFlag, selection: $gameName) {
+                        GuessTheFlagView(gameName: $gameName)
+                    } label: {
+                        GameButton(
+                            gradient: .main,
+                            level: "Level 1", symbol: "globe.americas.fill", name: "Guess the flag"
+                        )
+                    }
+                    
+                    NavigationLink(tag: GameName.guessTheCapital, selection: $gameName) {
+                        GuessTheCapitalView(gameName: $gameName)
+                    } label: {
+                        GameButton(
+                            gradient: .secondary,
+                            level: "Level 2", symbol: "globe.americas.fill", name: "Guess the capital"
+                        )
+                    }
+                }
+                .padding()
+            }
+            .navigationTitle("Select a game 🎮")
+            .toolbar {
+                Button {
+                    showingBuyLivesModal = true
+                } label: {
+                    Label("Buy lives", systemImage: "heart.fill")
+                }
+            }
+            .sheet(isPresented: $showingBuyLivesModal) {
+                BuyLivesModal()
+            }
+        }
+    }
+}
+
+struct ContentView_Previews: PreviewProvider {
+    static var previews: some View {
+        ContentView()
+    }
+}