import SwiftUI
struct SecondView: View {
var name: String
var body: some View {
Text("Main Dishses \(name)")
}
}
struct ContentView: View {
@State private var showingSheet = false
var body: some View {
Button("Menu") {
self.showingSheet.toggle()
}
.foregroundColor(.white)
.font(Font.largeTitle.weight(.bold))
.lineSpacing(50)
.frame(width: 300, height: 300, alignment: .bottomLeading)
.background(
Image("bg")
.resizable())
.cornerRadius(12)
.position(x: 150, y: 30)
.sheet(isPresented: $showingSheet) {
SecondView(name: "food")
.padding()
}
}
}
If I try to VStack this, I get errors because I'm adding struct view cmd into the VStack which is the only way to make that code work, I want to add at least 4 of these sheet view buttons, and everything I found online didn't work, please submit a working code of sheet view buttons in a VStack.