I've got an animated Image which is sliding up and down, using the offset and a timer. This works totally fine until you combine a GeometryReader and a NavigationView. For both, NavView and GeoReader on their own, the animation is working as well. Any solutions? (I know, in this example the GeometryReader is not needed)
struct TestView: View{
@State var offsetSwipeUp: CGFloat = 0
var body: some View{
let timer = Timer.publish(every: 1, on: .main, in: .common).autoconnect()
return NavigationView {
GeometryReader { geometry in
Image(systemName: "chevron.up")
.animation(.easeInOut(duration: 1))
.onReceive(timer){ _ in
if self.offsetSwipeUp == .zero{
self.offsetSwipeUp = -10
} else {
self.offsetSwipeUp = .zero
}
}
.offset(y: CGFloat(self.offsetSwipeUp))
.navigationBarTitle("")
.navigationBarHidden(true)
}
}
}
}