Hi Team,
I have a List as below listing data from Core Data and it’s working well, however I wish to view the details of a row when the user taps on a Row… Taking them to another View called ListItem() which is within the NavigationLink…
However I am not sure what code I use to send to the new View using the NavigationLink.
See List below…
Any help would be appreciated… thank you !
List {
ForEach(entry, id: .id) { entry in
NavigationLink(destination: ListItem() ) {
VStack(alignment: .leading){
HStack{
Image(“my-two-stroke-white”)
.resizable()
.frame(width: 20.0, height: 20.0)
Text(entry.name ?? “Unknown”)
.fontWeight(.bold)
.foregroundColor(Color.blue)
}
HStack(alignment: .center){
Text(entry.ratio ?? “Unknown”)
.foregroundColor(Color.purple)
Text(“Mix Ratio”)
.foregroundColor(Color.purple)
}
Text(entry.comment ?? “Unknown”)
.foregroundColor(Color.gray)
.lineLimit(3)
}
}
.padding(.top, 15.0)
}
.onDelete(perform: removeEntry)
}
Other View:
import SwiftUI
struct ListItem: View {
var body: some View {
Text(“Hello, World!”)
}
}
struct ListItem_Previews: PreviewProvider {
static var previews: some View {
ListItem()
}
}