I'm playing around a bit with SwiftUI and want to build a test app but I don't like the Modal presentation style, I rather have them full screen. After some googling I got this:
var body: some View {
Group {
if one {
MainView()
} else if two {
SecondView()
} else if three {
ThirdView()
} else {
ForthView()
}
}
}
How this works is that e.g. inside the ContentView()
you click a button which will toggle a boolean @State
, which itself will reload this view and one of the views inside of the Group
will show. Now I want this to have an animation/transition so you actually see MainView()
slide in from the right, and SecondView()
transition to top.
I've tried putting each view inside a withAnimation { }
and also setting .transition(move(.top))
but nothing seems to work.
Is this possible to do in SwiftUI?
I want these to animate