blog.iankulin.com

Animation

Animating Guess The Flag

This is a write-up of Project 6 of 100 Days of SwiftUI, which adds animations to the earlier Guess the Flag app. The tricky part was that all three flags are built in a ForEach, so animations applied to every button at once; the fix was storing each flag’s animation magnitude separately and animating unclicked flags by zero. I also cover re-animating the flags once the alert closes, along with my criticism of the tutorial’s alert UI...

Animation Feedback

A short comparison of two solutions to the Guess The Flags animation challenge: my approach of storing animation amounts in an Int array versus Paul’s more concise use of ternary operators in the modifiers. Both vary the effect depending on which flag was selected, but Paul’s version needs considerably less code...