I am passing UUID Key from View1 to View2. In View2, I need to Fetch entries using TabKey. userId is global variable working fine. Giving error TabKey. Please help. how to get rid of this error.
If I keep this logic inside init method, Getting new error saying that
"Cannot convert value of type 'FetchedResults' to expected argument type 'Binding'
Here is the Code.
@FetchRequest(
sortDescriptors: [NSSortDescriptor(keyPath: \Table2.date, ascending: false)],
predicate: {
guard let currentUserId = AppSession.shared.currentUserId else {
return NSPredicate(value: false) // Or handle the nil case as needed
}
return NSPredicate(format: "userId == %@ AND itemKey == %@", currentUserId as CVarArg, TabKey as CVarArg )
}(),
animation: .default
) private var itab: FetchedResults<Table2>