Skip to content

Collection Change Listeners Not Triggering in Swift Implementation #77

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
DominikZajac opened this issue May 7, 2025 · 0 comments
Open

Comments

@DominikZajac
Copy link
Contributor

Describe the bug
The collection_AddChangeListener and collection_AddDocumentChangeListener methods in the Swift implementation are not triggering the provided listeners when changes are made to the collection. The same functionality works correctly in the Kotlin implementation. In Swift, the collection and documents are correctly passed and saved, and the implementation appears to be in line with other working methods, but the listeners are not being triggered.

Expected behavior
The collection_AddChangeListener and collection_AddDocumentChangeListener methods should trigger the provided listeners when changes (e.g., document additions, updates, or deletions) are made to the collection. The listeners should receive the appropriate CollectionChange or DocumentChange objects.

Current behavior

  • The listeners registered via collection_AddChangeListener and collection_AddDocumentChangeListener are not being triggered when changes are made to the collection.
  • The collection and documents are correctly passed and saved, and there are no build errors or runtime exceptions.
  • The issue is specific to the Swift implementation, as the Kotlin implementation works as expected.

Link to public reproduction project repository
The issue can be reproduced in the example app provided in this repo.

To Reproduce
Steps to reproduce the behavior:

  • Set up the CBL-Ionic project and run it on iOS.
  • Observe the testCollectionChangeListener and testCollectionDocumentChangeListener.
  • Verify that the listeners are not triggered when changes are made to the collection in the Swift implementation.
  • Compare the behavior with the Kotlin implementation, where the listeners are triggered as expected. (Based on when you look the tests might not pass for Kotlin implementation or be commented out, but a log added to the listener callback will show up in the console).

Plugin Version
Version: 1.0.0

Affected Platforms:
Device: iOS Simulator (e.g., iPhone 16 Pro)
OS: iOS 18.3

Do you have a workaround?
No

Additional Information
The issue is specific to the Swift implementation of collection_AddChangeListener and collection_AddDocumentChangeListener.
The collection and documents are correctly passed and saved, and the implementation appears to be in line with other working methods.
The Kotlin implementation of the same functionality works as expected, and the listeners are triggered when changes are made to the collection.
Debugging steps, such as verifying listener registration, threading, and collection consistency, have not revealed any obvious issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant