comparison GeoQuiz/GuessTheCountryView.swift @ 33:6d574bd1644f

refactor controllers
author Dennis C. M. <dennis@denniscm.com>
date Sat, 12 Nov 2022 11:18:30 +0100
parents 9d6dd0e59c22
children
comparison
equal deleted inserted replaced
32:c62d6f92709d 33:6d574bd1644f
46 ForEach(Array(gameController.userChoices.keys), id: \.self) { cityName in 46 ForEach(Array(gameController.userChoices.keys), id: \.self) { cityName in
47 Button { 47 Button {
48 gameController.answer( 48 gameController.answer(
49 choice: (key: cityName, value: gameController.data[cityName]!), 49 choice: (key: cityName, value: gameController.data[cityName]!),
50 wrongMessage: "\(gameController.correctAnswer.key) is located in \(gameController.correctAnswer.value.country)" 50 wrongMessage: "\(gameController.correctAnswer.key) is located in \(gameController.correctAnswer.value.country)"
51 ) { 51 )
52 gameController.selector()
53 }
54 } label: { 52 } label: {
55 AnswerButton( 53 AnswerButton(
56 name: gameController.data[cityName]!.country, 54 name: gameController.data[cityName]!.country,
57 color: .blueBell 55 color: .blueBell
58 ) 56 )