我的TabView
设置如下:
struct ContentView: View {
@State private var selection = 0
@State var newListingPresented = false
var body: some View {
TabView(selection: $selection){
// Browse
BrowseView()
.tabItem {
VStack {
Image(systemName: (selection == 0 ? "square.grid.2x2.fill" : "square.grid.2x2"))
}
}
.tag(0)
// New Listing
NewListingView()
.tabItem {
VStack {
Image(systemName: (selection == 1 ? "plus.square.fill" : "plus.square"))
}
}
.tag(1)
// Bag
BagView()
.tabItem {
VStack {
Image(systemName: (selection == 2 ? "bag.fill" : "bag"))
}
}
.tag(2)
// Profile
ProfileView()
.tabItem {
VStack {
Image(systemName: (selection == 3 ? "person.crop.square.fill" : "person.crop.square"))
}
}
.tag(3)
}.edgesIgnoringSafeArea(.top)
}
}
问题:点击时,如何获取“新列表”选项卡以模态显示NewListingView
(在SwiftUI中称为工作表?)?
我的TabView设置如下:struct ContentView:View {@State私有var选择= 0 @State var newListingPresented = false var正文:某些视图{TabView(selection:$ ...