Swift SDK: Collection Change Listener vs. Replication Listener

I’m using the Couchbase Lite Swift SDK with Capella and Sync Gateway.

The Collection change API (collection.addChangeListener()) seems to duplicate (and obviate?) the document replication listener API. That is, every remote change that the replicator pulls down shows up in the Collection change handler. If I have both the document replication listener AND Collection change listener set up, each fires once when the replicator pulls down a remote change.

  1. Can I rely on the Collection change listener API to always report every single change? It won’t drop some during high-frequency updates, for example? It will always capture all the changes that the replicator pulls down?

  2. The document replication listener lets me see if a document has been deleted. The Collection change listener does not seem to provide that info. Is that planned? Right now, I have to try to fetch the document and assume it’s been deleted if that fails.

  1. Yes, the collection change listener reports every single change to the collection, whether by you or by the replicator.
  2. Good idea. I filed a Jira issue to track it.
1 Like