The solution from mentioned reference works, just the swipe is blocked not by gesture(nil)
, but by gesture(DragGesture())
. And view should be full-tab-content-view-wide, like
TabView {
ForEach(0..<5) { idx in
Text("Cell: \(idx)")
.frame(maxWidth: .infinity, maxHeight: .infinity)
.contentShape(Rectangle())
.gesture(DragGesture()) // this blocks swipe
}
}
.tabViewStyle(PageTabViewStyle())
Tested with Xcode 12.1 / iOS 14.1
* and, of course, it can be made conditional as in https://stackoverflow.com/a/63170431/12299030