Day 34 Complete

2022-07-30 1 min read

Wow, Day 34 of the 100 Days of SwiftUI was a very satisfyingly difficult challenge that took me a good hour and a bit of concentration to eventually complete.

I was initially confused about where the rotate and opacity modifiers should go I tried on the button, in the action of the button, in the FlagImage view and nothing I tried worked. Eventually I re-read the question text and realised the hint I’d missed “Try adding an @State property to track which flag the user tapped on” ! At that point I then did just that, and then I placed the modifiers in the ’label:’ section of the button, after the FlagImage view, modifying the actual FlagImage (which is of-course, all that needed to be modified). Then using a condition inside the modifier I was able to control which flag got modified and which didn’t.

For the final part of the challenge, I scaled the flags not tapped down to 25%.