I'm making a to-do list app and I have an ItemModel which just stores the title(String) and boolean.
So from the list, I want to be able to click on the title and push that title(String value) into a different view
How can I do this?
Model
import Foundation
struct ItemModel: Identifiable, Hashable{
let id: String = UUID().uuidString
let title:String
}
The List
List {
ForEach(items) {item in
NavigationLink(item.title, value: item)
}
.navigationDestination(for: String.self) { toDoItem
SpecificItemView(item: toDoItem.title)
}