How to observe fetchCount #375

Closed
opened 2025-12-29 18:26:14 +01:00 by adam · 2 comments
Owner

Originally created by @Feuerwerk on GitHub (Sep 23, 2021).

Hi,

Is there a way in CoreStore to observe the number of records in a table the same way one can use List-/ObjectPublisher or Combine to observe the records itself? In my case i don't want to use the ListPublisher since i don't want to fetch all records when they change and count them. Or does ListSnapshot.count don't fetch all records?

Originally created by @Feuerwerk on GitHub (Sep 23, 2021). Hi, Is there a way in CoreStore to observe the number of records in a table the same way one can use List-/ObjectPublisher or Combine to observe the records itself? In my case i don't want to use the ListPublisher since i don't want to fetch all records when they change and count them. Or does ListSnapshot.count don't fetch all records?
adam added the question label 2025-12-29 18:26:14 +01:00
adam closed this issue 2025-12-29 18:26:14 +01:00
Author
Owner

@JohnEstropia commented on GitHub (Sep 23, 2021):

ListSnapshot.count does rely on fetched arrays in order to count them. My suggestion would be to cache this count to one of your entities' property and observe that value instead.

@JohnEstropia commented on GitHub (Sep 23, 2021): ListSnapshot.count does rely on fetched arrays in order to count them. My suggestion would be to cache this count to one of your entities' property and observe that value instead.
Author
Owner

@Feuerwerk commented on GitHub (Sep 24, 2021):

Thanks for your help. :-)

@Feuerwerk commented on GitHub (Sep 24, 2021): Thanks for your help. :-)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/CoreStore-JohnEstropia#375