Categories
Mastering Development

reload FetchedResults when changing the predicate in swiftUI

i’m building a todo app with swiftUI and Core Data. in the listView i have a button that’ll change the predicate for the fetchrequest, but i can’t get it to work. code in the listView struct HomeListView: View { @Environment(\.managedObjectContext) var context @FetchRequest(fetchRequest: ItemEntity.loadItems()) var items: FetchedResults<ItemEntity> Text(“someText”) .onTapGesture { ItemEntity.predicateType.next() //next() is a method […]