diff GeoQuiz/Helpers/GameToolbar.swift @ 6:1946bbfde4af

reformat data structures
author Dennis C. M. <dennis@denniscm.com>
date Thu, 29 Sep 2022 12:00:17 +0200
parents de54f05adb78
children d945e52b0704
line wrap: on
line diff
--- a/GeoQuiz/Helpers/GameToolbar.swift	Sat Sep 24 12:02:09 2022 +0100
+++ b/GeoQuiz/Helpers/GameToolbar.swift	Thu Sep 29 12:00:17 2022 +0200
@@ -10,6 +10,7 @@
 struct GameToolbar<T: Game>: View {
     @ObservedObject var game: T
     
+    var color: Color
     
     var body: some View {
         HStack(spacing: 0) {
@@ -18,14 +19,15 @@
                     game.showingExitGameAlert = true
                 } label: {
                     Image(systemName: "multiply")
+                        .font(.headline)
+                        .foregroundColor(color)
                         .padding(10)
                         .background(
                             Circle()
-                                .strokeBorder(lineWidth: 2)
+                                .foregroundColor(.white)
                         )
                 }
             }
-            .foregroundColor(.white)
             .font(.headline)
             .frame(maxWidth: .infinity, alignment: .leading)
             
@@ -34,14 +36,15 @@
                     game.showingGameStatsView = true
                 } label: {
                     Text("\(game.userScore)")
+                        .font(.title.bold())
+                        .foregroundColor(color)
                         .padding()
                         .background(
                             Circle()
-                                .strokeBorder(lineWidth: 3)
+                                .foregroundColor(.white)
                         )
                 }
             }
-            .foregroundColor(.white)
             .font(.title2)
             .scaleEffect(game.scoreScaleAmount)
             .frame(maxWidth: .infinity, alignment: .center)
@@ -54,15 +57,16 @@
                         Image(systemName: "heart.fill")
                         Text("\(game.userLives)")
                     }
+                    .font(.headline)
+                    .foregroundColor(color)
                     .padding(10)
                     .background(
                         Capsule()
-                            .strokeBorder(lineWidth: 2)
+                            .foregroundColor(.white)
                     )
                     .scaleEffect(game.livesScaleAmount)
                 }
             }
-            .foregroundColor(.white)
             .font(.headline)
             .frame(maxWidth: .infinity, alignment: .trailing)
         }
@@ -77,7 +81,7 @@
             
             GeometryReader { geo in
                 VStack {
-                    GameToolbar(game: GuessTheFlag())
+                    GameToolbar(game: CountryGame(), color: .mayaBlue)
                     
                     Spacer()
                 }