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
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.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
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?
@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.
@Feuerwerk commented on GitHub (Sep 24, 2021):
Thanks for your help. :-)