comparison GeoQuiz/GuessThePopulationView.swift @ 19:f140bb277c96

refactor code
author Dennis C. M. <dennis@denniscm.com>
date Sun, 23 Oct 2022 00:11:38 +0100
parents f1967f8cc67b
children e281791e0494
comparison
equal deleted inserted replaced
18:d20cf93c9812 19:f140bb277c96
6 // 6 //
7 7
8 import SwiftUI 8 import SwiftUI
9 9
10 struct GuessThePopulationView: View { 10 struct GuessThePopulationView: View {
11 @StateObject var game = CountryGame() 11 @StateObject var game = CountryGameController()
12 12
13 @Environment(\.managedObjectContext) var moc 13 @Environment(\.managedObjectContext) var moc
14 14
15 var body: some View { 15 var body: some View {
16 ZStack { 16 ZStack {
49 game.selector() 49 game.selector()
50 } 50 }
51 } label: { 51 } label: {
52 let population = game.data[countryName]!.population 52 let population = game.data[countryName]!.population
53 AnswerButton( 53 AnswerButton(
54 optionName: population.formattedWithSeparator, 54 name: population.formattedWithSeparator,
55 color: .middleRed 55 color: .middleRed
56 ) 56 )
57 .frame(height: geo.size.height * 0.08) 57 .frame(height: geo.size.height * 0.08)
58 } 58 }
59 } 59 }