I've stumbled across what looks like a bug caused by a NavigationView
.
For the reproducible code here we have two circles that pulsate . It works fine, until we add the NavigationView
! What is going on? I'm pretty sure this is a bug, but is it well known, any workarounds?
GLIMPSE OF GLITCHING ANIMATION
REPRODUCIBLE CODE :
import SwiftUI
struct ContentView: View {
@State private var animationAmount: CGFloat = 1
var body: some View {
NavigationView {
HStack {
Circle()
.frame(width: 100, height: 100)
.overlay (
Circle()
.stroke()
.scaleEffect(animationAmount)
.opacity(Double(2 - animationAmount))
.animation(
Animation.easeInOut(duration: 1).repeatForever(autoreverses: false)
)
).onAppear {
self.animationAmount = 2
}
Circle()
.frame(width: 100, height: 100)
.overlay (
Circle()
.stroke()
.scaleEffect(animationAmount)
.opacity(Double(2 - animationAmount))
.animation(
Animation.easeInOut(duration: 1).repeatForever(autoreverses: false)
))
}
}
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}