Skip to content
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

[Feature Request] Support Key Path Change Listener #172

Open
mtgto opened this issue Sep 19, 2021 · 1 comment
Open

[Feature Request] Support Key Path Change Listener #172

mtgto opened this issue Sep 19, 2021 · 1 comment

Comments

@mtgto
Copy link

mtgto commented Sep 19, 2021

Since Realm 10.12.0, function observe can receive keyPaths parameter, which can select object properties object or collection.
https://docs.mongodb.com/realm/sdk/ios/examples/react-to-changes/#register-a-key-path-change-listener

I want to write code with RxRealm like below 😍 :

Observable.changeset(from: dogs, keyPaths: ["favoriteToy", "age"])
  .subscribe(onNext: { results, changes in
    if let changes = changes {
      // it's an update
      print(results)
      print("deleted: \(changes.deleted)")
      print("inserted: \(changes.inserted)")
      print("updated: \(changes.updated)")
    } else {
      // it's the initial data
      print(results)
    }
  })
@JoeMatt
Copy link
Contributor

JoeMatt commented Jan 22, 2022

I like this idea. I use keypaths a lot. Would prefer it there was KeyPath usage though other than strigs, if it's possible. I hope to look into this but if anyone wants to work on this, I will review any PRs.

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

No branches or pull requests

2 participants