I could not get the trapezoid to animate as shown in the project (Animating simple shapes with animatableData). I am using Xcode Version 13.3 (13E113). To get it to work, I switched to the .animation(_ animation: Animation?, value: V) -> some View
view modifier instead of the withAnimation { }
function.
Trapezoid(insetAmount: insetAmount)
.animation(.default, value: insetAmount)
.frame(width: 200, height: 100)
.onTapGesture {
//withAnimation {
insetAmount = Double.random(in: 10...90)
//}
}
Nothing in the definition of the Trapezoid Shape was changed from what was presented in Day 45. Again I solved it the same way as above. Interestingly, since both values (rows and columns) change together, and you can provide only one value to .animation(_ animation: Animation?, value: V) -> some View
, it still works when you provide just one of the two values that change.
The same also happened with Checkerboard(Animating complex shapes with AnimatablePair).
Checkerboard(rows: rows, columns: columns)
.animation(.default, value: rows)
.onTapGesture {
//withAnimation(.linear(duration: 3)) {
rows = Int.random(in: 4...16)
columns = Int.random(in: 4...16)
//}
}
I'd be interested to hear if anyone else is experiencing difficulties with this and how you solved them.