(Sample code is added)
I am trying to use SwiftUI to build a selectable list like the original Tableview in Swift.
I would like to show a detail view when the user tab on the selected item. However, the only way I find to implement it is to use NavigationView and NavigationLink.
Do anyone know is there any other way to implement a selectable list by SwiftUI?
Below is the sample I implemented :
NavigationView{
List{
ForEach(items, id: \.id){ item in
NavigationLink(destination: WorkItemDetailView(item: item)){
WorkItemListRow(item: item)
}
}
}
}
WorkItemListRow is to present the object in the cell of the list. WorkItemDetailView is the detail view will show the detail of the object.