Reputation: 57
I have a little issue and I do not know how can i solve this. Basically, i have a SwiftUI View which contains more "little" views, when the button is pressed, is changhing to the next View, but my Button is always over my view. How can I put the button on the same level with the View ?
var body: some View {
ZStack {
ZStack {
switch onboardingState {
case 0 :
welcomeSection
.transition(transition)
case 1 :
detailOrder
.transition(transition)
case 2 :
detailOrder2
.transition(transition)
default:
EmptyView()
}
}
VStack {
Spacer()
bottomButton
}
.padding(30)
}
}
Upvotes: 1
Views: 1420
Reputation: 46
You are using Zstack which is used for putting views on top of each other. change outer ZStack to Vstack and your problem is solved.
Upvotes: 0
Reputation: 563
Try this
var body: some View {
VStack {
ZStack {
switch onboardingState {
case 0 :
welcomeSection
.transition(transition)
case 1 :
detailOrder
.transition(transition)
case 2 :
detailOrder2
.transition(transition)
default:
EmptyView()
}
}
Spacer()
bottomButton
.padding(30)
}
}
Upvotes: 2