mirror of
https://github.com/JohnEstropia/CoreStore.git
synced 2026-01-11 20:00:30 +01:00
Creating a list monitor from a relationship #283
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @zachwaugh on GitHub (Aug 8, 2019).
I'm currently creating a list monitor by building a query, but I'm wondering if there is a simpler way. For example, if I have a
Postentity which has manyAuthors (andAuthorhas manyPosts), I need to do something like this to get a live list of all the posts from an author:But would I love to do this:
Is there any way to do something along those lines instead of recreating the full query?
@JohnEstropia commented on GitHub (Aug 13, 2019):
NSFetchResultsController, whichListMonitoruses internally, does not support observing on relationships. You might want to create a denormalized entity betweenPostandAuthorthat will contain one row for each author for a particular post, observe that list, extract an array of objectIDs on didChange, and fetch the list ofPosts using the objectIDs.@zachwaugh commented on GitHub (Aug 13, 2019):
Thanks for the answer! It's not too bad to recreate the query, just hoping to avoid the redundancy if possible.