Beta 5 now includes a template. But the template doesn't appear to have a saveContext for when the scene moves to the background. Am I missing something?
Post
Replies
Boosts
Views
Activity
For the Core Data issue, wrap the body in a NavigationView.
Can anyone confirm that .toolbar requires a NavigationView?
Thanks!
Lost track of the forest through the trees...this was not a XML problem at all!
I used @ObservedObject instead of @State and also had to add a DispatchQueue when updating itemStore.
It's a part of a larger subquery since I'm going across relationships, but here's the relevant part...
SUBQUERY(groceryItems, $x, $x.name IN %@).@count>0, desiredGroceries)
where desiredGroceries = Set<String>{"Milk", "Eggs}
and add or remove items via buttons.
I'm using Core Data entities with a many-to-many relationship (GroceryList <<->> GroceryItem). I cannot change the Core Data model without impacting other functionality.
Entity: GroceryList
Attribute: groceryListName: String?
Relationship: GroceryItems
Entity: GroceryItem
Attribute: groceryItemName: String?
Relationship: GroceryLists
I need a view with filter options to display Grocery Lists. The filter options populates a Set<String> called desiredGroceries from toggles. In this example, the user would want to see Grocery lists that had Milk and Eggs, so would toggle Milk, toggle Eggs, and not toggle any others. This results in: desiredGroceries("Milk", "Eggs")
To get the lists, I use:
fetchRequest = FetchRequest<GroceryList>(entity: GroceryList.entity(),
sortDescriptors: [],
predicate: NSPredicate(format: "SUBQUERY(groceryItems, $x, $x.name IN %@).@count>0", desiredGroceries))
My problem is that if the user selects more than one of the filter options (ie Milk and Eggs), it will show lists that have milk as well as lists that have eggs.
This code works as expected but not as desired.
I just want the lists that have milk AND eggs, not milk OR eggs.