CoreStore.monitorSectionedList ordering issue. #286

Closed
opened 2025-12-29 15:28:12 +01:00 by adam · 2 comments
Owner

Originally created by @matrosovDev on GitHub (Aug 15, 2019).

Need your help! Can you please comment on this question

Originally created by @matrosovDev on GitHub (Aug 15, 2019). Need your help! Can you please comment on this [question](https://stackoverflow.com/questions/57515496/swift-corestore-ordering-list-monitor-issue)
adam closed this issue 2025-12-29 15:28:12 +01:00
Author
Owner
@JohnEstropia commented on GitHub (Aug 17, 2019): https://stackoverflow.com/questions/57515496/swift-corestore-ordering-list-monitor-issue/57538668#57538668
Author
Owner

@matrosovDev commented on GitHub (Aug 30, 2019):

the question is answered by John here:

Just want to post it here as well. If you have cities and states as in my example and you want to listen to cities updates which are sectioned by states, you need to .orderBy states names and also .orderBy cities name not just cities then you will see ordering in the section instead of all ordering through all section. This code work for me:

self.monitor = CoreStore.monitorSectionedList(
                From<ListEntityType>()
                    .sectionBy(#keyPath(ListEntityType.state.name))
                    .orderBy(.ascending(#keyPath(ListEntityType.state.name)), .ascending(\.name))
            )

Thanks @JohnEstropia =)

@matrosovDev commented on GitHub (Aug 30, 2019): the question is answered by John [here](https://stackoverflow.com/questions/57515496/swift-corestore-ordering-list-monitor-issue/57538668#57538668): Just want to post it here as well. If you have cities and states as in my example and you want to listen to cities updates which are sectioned by states, you need to .orderBy states names and also .orderBy cities name not just cities then you will see ordering in the section instead of all ordering through all section. This code work for me: ``` self.monitor = CoreStore.monitorSectionedList( From<ListEntityType>() .sectionBy(#keyPath(ListEntityType.state.name)) .orderBy(.ascending(#keyPath(ListEntityType.state.name)), .ascending(\.name)) ) ``` Thanks @JohnEstropia =)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/CoreStore#286