Realm RealmCollectionChange get changed property

Viewed 802

I have an "Owner" class that has a list property of dogs

class Owner: Object {

    dynamic var name: String?

    let list = List<RString>()

}

I added a notification token to the list of Owner

owners?.addNotificationBlock { [weak self] (changes: RealmCollectionChange) in 

    updateUI()

}

The problem is, whenever the properties of RString are changed, and one of the owners has the changed RString in his list, this notification is triggered

What I want is to ignore changes that happen to RString objects and avoid triggering the notification

Is there a way to add "ignoringProperties" to the collectionChanges just like the one in objectChange? Or any other workaround?! like getting the name of the changed property and ignoring it manually?

I have seen this code in one of Realm official videos but couldn't replicate it for collectionChanges

let token2 = state.addNotificationBlock(ignoringProperties: ["noisyProp"],
                                    block: { change in
  // handle change and avoid being notified for properties we don't care about
})

source

Thanks for your help

1 Answers
Related