diff GeoQuiz/GuessTheFlagView.swift @ 6:1946bbfde4af

reformat data structures
author Dennis C. M. <dennis@denniscm.com>
date Thu, 29 Sep 2022 12:00:17 +0200
parents f31a61462e7a
children d945e52b0704
line wrap: on
line diff
--- a/GeoQuiz/GuessTheFlagView.swift	Sat Sep 24 12:02:09 2022 +0100
+++ b/GeoQuiz/GuessTheFlagView.swift	Thu Sep 29 12:00:17 2022 +0200
@@ -6,11 +6,10 @@
 //
 
 import SwiftUI
-import AVFAudio
 
 struct GuessTheFlagView: View {
     @Binding var gameName: GameName?
-    @StateObject var game = GuessTheFlag()
+    @StateObject var game = CountryGame()
     
     var body: some View {
         ZStack {
@@ -19,19 +18,20 @@
             
             GeometryReader { geo in
                 VStack(spacing: 20) {
-                    GameToolbar(game: game)
+                    GameToolbar(game: game, color: .mayaBlue)
                     
                     HStack {
                         VStack(alignment: .leading, spacing: 10) {
                             Text("Question \(game.questionCounter) of \(game.data.count)")
                                 .font(.title3)
-
+                                .foregroundColor(.white.opacity(0.7))
+                            
                             Text("What is the flag of \(game.correctAnswer.key)?")
                                 .font(.title)
                                 .fontWeight(.semibold)
+                                .foregroundColor(.white)
                         }
-                        .foregroundColor(.white)
-
+                        
                         Spacer()
                     }
                     
@@ -41,7 +41,7 @@
                         Button {
                             game.answer((key: countryName, value: game.data[countryName]!))
                         } label: {
-                            FlagImage(flagSymbol: game.data[countryName]!, cornerRadius: 20)
+                            FlagImage(flagSymbol: game.data[countryName]!.flag, cornerRadius: 20)
                                 .shadow(radius: 10)
                                 .frame(height: geo.size.height * 0.15)
                         }
@@ -60,7 +60,7 @@
         }
         
         .sheet(isPresented: $game.showingGameStatsView) {
-            GameStatsModalView(game: game)
+//            GameStatsModalView(game: game)
         }
     }
 }