I'm quite new to SwiftUI and having some troubles.
I have a Tab View:
Picker(selection: $selectedTab, label: Text("")) {
Text("1")
.tag(0)
Text("2")
.tag(1)
}
.pickerStyle(SegmentedPickerStyle())
TabView(selection: $selectedTab) {
View1()
.tag(0)
View2()
.tag(1)
}
.tabViewStyle(PageTabViewStyle(indexDisplayMode: .never))
The View1 has a List and For-Each:
List {
ForEach(items) { item in
ItemRow()
}
.onDelete(perform: deleteItem)
}
.listStyle(PlainListStyle())
Now it's not possible to delete the RowItems with the onDelete function because the TabView is always changing to the View2.
One solution would be, to disable the "swipe between tabs" with for example:
.gesture(DragGesture())
But then I have to try to swipe single rows multiple times before the Delete works.
Best would be, to disable the "swipe between views" and that onDelete would work. Can you help me with that?