comparison GeoQuiz/GuessThePopulationView.swift @ 33:6d574bd1644f

refactor controllers
author Dennis C. M. <dennis@denniscm.com>
date Sat, 12 Nov 2022 11:18:30 +0100
parents 3f4b366d476d
children
comparison
equal deleted inserted replaced
32:c62d6f92709d 33:6d574bd1644f
63 ForEach(Array(gameController.userChoices.keys), id: \.self) { countryName in 63 ForEach(Array(gameController.userChoices.keys), id: \.self) { countryName in
64 Button { 64 Button {
65 gameController.answer( 65 gameController.answer(
66 choice: (key: countryName, value: gameController.data[countryName]!), 66 choice: (key: countryName, value: gameController.data[countryName]!),
67 wrongMessage: "That's the population of \(countryName)" 67 wrongMessage: "That's the population of \(countryName)"
68 ) { 68 )
69 gameController.selector()
70 }
71 } label: { 69 } label: {
72 let population = gameController.data[countryName]!.population 70 let population = gameController.data[countryName]!.population
73 AnswerButton( 71 AnswerButton(
74 name: population.formattedWithSeparator, 72 name: population.formattedWithSeparator,
75 color: .middleRed 73 color: .middleRed