是否可以在 SwiftUI 的子视图中显示工作表,其父视图中已经有工作表?
struct SheetTest: View {
@State var showFirstSheet = false
var body: some View {
VStack {
Text("FirstView")
.onTapGesture(count: 1, perform: {
showFirstSheet = true
})
SomeView()
}
.sheet(isPresented: $showFirstSheet, content: {
Text("firstsheet")
})
}
}
struct SomeView:View {
@State var showSecondSheet = false
var body: some View {
Text("SecondView")
.onTapGesture(count: 1, perform: {
showSecondSheet = true
})
.sheet(isPresented: $showSecondSheet, content: {
Text("secondsheet")
})
}
}
我目前正在使用 Xcode 12 beta 3!第二张纸不能以这种方式呈现!我必须在父视图中呈现它!