SwiftfulRouting
SwiftfulRouting copied to clipboard
Animation moved start from top leading when applying the RouterView wrapper
RouterView Wrapper seems might affect the Animation view
- Without RouterView:
import SwiftUI
import SwiftfulRouting
struct ContentView: View {
var body: some View {
// RouterView { _ in
LandingView()
// }
}
}
struct LandingView: View {
@State private var isSpinning = false
var body: some View {
VStack(){
Rectangle()
.fill(.orange.opacity(0.3))
.frame(width: 256)
}
.rotationEffect(.degrees(isSpinning ? 360 : 0))
.onAppear() {
self.isSpinning = true
}
.animation(Animation.linear(duration: 3).repeatForever(autoreverses: false), value: isSpinning)
}
}
https://github.com/user-attachments/assets/584a174b-cf27-4b39-ba88-3ac4dd5b56bf
The View is Spinning in the screen center as expected when not applying RouterView
After Apply RouterView:
import SwiftUI
import SwiftfulRouting
struct ContentView: View {
var body: some View {
RouterView { _ in
LandingView()
}
}
}
https://github.com/user-attachments/assets/29adef30-f92c-4bb4-9550-5b49ea196d4a
This is weird but it seems to work with .task instead of .onAppear. I'll look into this...
.task {
self.isSpinning = true
}
FYI:Might related to NavigationStack
This should be fixed in Version 6 (https://github.com/SwiftfulThinking/SwiftfulRouting/releases/tag/beta-6.1)