mirror of
https://github.com/JohnEstropia/CoreStore.git
synced 2026-01-13 23:23:29 +01:00
How to sort by relationship? #109
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 @ghost on GitHub (Dec 13, 2016).
I have an entity Person, each person has many messages. I wish to sort my tableview based on the last message's timestamp per each Person. Essentially, accomplish something like this .
let People: ListMonitor = {
@JohnEstropia commented on GitHub (Dec 14, 2016):
Unfortunately, Core Data doesn't support sorting lists with relationships. My suggestion is to add a
messageCountattribute in thePersonentity which you update whenever a message is added to a person. You can then use that attribute to sort.@ghost commented on GitHub (Dec 15, 2016):
Thank you John, just making sure I wasn't missing out on a feature. I guess that should work !