comparison GeoQuiz/GuessTheFlagView.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
46 ForEach(Array(gameController.userChoices.keys), id: \.self) { countryName in 46 ForEach(Array(gameController.userChoices.keys), id: \.self) { countryName in
47 Button { 47 Button {
48 gameController.answer( 48 gameController.answer(
49 choice: (key: countryName, value: gameController.data[countryName]!), 49 choice: (key: countryName, value: gameController.data[countryName]!),
50 wrongMessage: "That's the flag of \(countryName)" 50 wrongMessage: "That's the flag of \(countryName)"
51 ) { 51 )
52 gameController.selector()
53 }
54 } label: { 52 } label: {
55 53
56 /* 54 /*
57 THE PROBLEM: 55 THE PROBLEM:
58 SwiftUI caches the image when it's shown using the `Image(string)` API. 56 SwiftUI caches the image when it's shown using the `Image(string)` API.