Hello everyone!
I'm having a problem with my code and I don't know how to fix it. In fact, when I click the green circle, it gets bigger by wiping out the others, but the purple overlaps. Is there a way to get the purple away too?
Another problem: I have a warning where it says .animation(.spring())
and the warning says "'animation' was deprecated in iOS 15.0: Use withAnimation or animation(_:value:) instead."
import SwiftUI
struct ContentView: View {
var body: some View {
LazyVGrid(columns: [GridItem(), GridItem(), GridItem()]) {
createCircle()
.foregroundColor(.blue)
createCircle()
.foregroundColor(.green)
createCircle()
.foregroundColor(.purple)
createCircle()
.foregroundColor(.orange)
createCircle()
.foregroundColor(.yellow)
}
}
struct createCircle: View {
@State var scale : CGFloat = 0.25
var body: some View {
ZStack {
Circle()
.frame(width: 500 * scale, height: 500 * scale)
.onTapGesture {
scale = 5
}
.animation(.spring()) // WARNING: 'animation' was deprecated in iOS 15.0: Use withAnimation or animation(_:value:) instead.
.animation(.interpolatingSpring(stiffness: 50, damping: 1), value: scale)
}
}
}
}
Can anyone help me?