Adrien Giboire Adrien Giboire - 1 year ago 85
Swift Question

How to set watchers on Realm model?

For debugging purposes, I would like to set watchers/observers on models but I didn't find hint so far.

Notice I'm rather new in iOS development (less than a month) so I might be missing something.

Answer Source

If you want to observe a whole class of objects, you can make a query, apply filters and then observe these Results for Notifications.

If you want to observe changes to a single object, you can retrieve it and then observe the properties you're interested in via Key-Value Observation (KVO).