Skip to content

Collection Change Listeners Not Triggering in Swift Implementation #77

Open
@DominikZajac

Description

@DominikZajac

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions