iOS - RxRealm - Is it possible to get updated event even if the dataset is not changed

Is it possible in RxRealm to get a notification even if my dataset is the same? When I subscribe to the collection (no items at app launch) I get back an empty array. (it's fine at this point) My problem is that my API request may return with an empty array as well, and in this case, I didn’t get any notification from the RxRealm.collection, So I don't know if my request is finished or I was just reading the database.

I tried to call realm.refresh() but it didn't help

This is what I'm observing:

func findAll() -> Results<T> {
    return realm.objects(T.self)

Observable.collection(from: findAll()).map(Array.init) 

This is how I rebuild my database after API request is finished:

func rebuildDatabase(objects: [T], with update: Bool = false) {
        realm.refresh() // trying to force refresh event
        do {
            realm.add(objects, update: update)
            try realm.commitWrite()
        } catch {

Is it possible to archive this behavior with some configuration or is there any line of code that will force the notification? Thank for all the answers

0 Answers