Hello Everyone,
I’m currently reading Chapter 11: Gestures.
.animation(_ animation:) modifier is deprecated and in iOS 15 there is a required parameter “value” where, according to apple documentation, “value” is “A value to monitor for changes.”
In our case what value are we monitoring?
import SwiftUI
struct CardView: View {
var body: some View {
ZStack {
Rectangle()
.fill(Color.red)
.frame(width: 320, height: 210)
.cornerRadius(12)
VStack {
Spacer()
Text("Apple")
.font(.largeTitle)
.foregroundColor(.white)
Text("Omena")
.font(.caption)
.foregroundColor(.white)
Spacer()
}
}
.shadow(radius: 8)
.frame(width: 320, height: 210)
.animation(.spring()) // * yellow warning: 'animation' was deprecated in iOS 15.0: Use withAnimation or animation(_:value:) instead.
.animation(.spring(), value: ??)
}
}
struct CardView_Previews: PreviewProvider {
static var previews: some View {
CardView()
}
}