0

Using the code below, I'm displaying a list of filtered items that when clicked leads to a detailed items page ItemDetailView(item: item) for that specific row. I am trying to make it so that the user, once on the details page can then swipe left or right to go either up or down the list of filtered items and view the detailed page of those without having to navigate back to the list view.

So for instance, if they click on item 2 in a list of 5 items it takes them to the details of item 2 through NavigationLink. Once on the details page, I want to be able to swipe left to see the details page for item 1. Likewise, if I swipe right, I want to be able to see the details for item 3.

if let filteredItems = itemModel.items.filter { $0.isBetween(dateSelected.date!.startOfDay) } { ForEach(foundItems) { item in 
NavigationLink ( destination: ItemDetailView(item: item) ) { ListViewRow(item:item)} }

I've tried using TabView with the code below, but once in the details view, I end up with a vertically scrollable details view of each item. Any suggestions on how I can accomplish the result I'm looking for? Any hints pointing me in the right direction would be appreciated.

if let filteredItems = itemModel.items.filter { $0.isBetween(dateSelected.date!.startOfDay) } { ForEach(foundItems) { item in 
NavigationLink(
destination: TabView(){ 
List(itemModel.items) {item in ItemDetailView(item: item) } 
}.tabViewStyle(.page) 
) { ListViewRow(item:item) } 
} }

Diagram:

diagram

Anton Menshov
  • 2,266
  • 14
  • 34
  • 55
tonkatsu
  • 1
  • 1

0 Answers0