Realm Notifications (RealmSwift Part 2)

https://realm.io/docs/swift/latest/

Realm Notification

Types of Notification

Figure 1
Figure 2
Figure 3
Figure 4
Figure 5
Figure 6
Figure 7
Figure 8
Figure 9
Figure 10
Figure 11

Object Level Notification

  • change(properties): When a property value is modified. properties is of type [PropertyChange] and provides information about which properties changed, along with the changed values, old and new.
  • deleted: Emitted once the object is deleted and you can no longer observe it.
Figure 12
  1. We are observing Passport object on main thread and we updated passport information on background thread. You’ll be notified about changes made to your data from any of your app’s threads, or even other processes. The notification handler is called on the same thread where you subscribed for the notifications. Since we subscribed on main thread we are getting handler on main thread
  2. Object level observer gives the fine-grained change information as shown in Figure 13 it gives the information about the property name , it’s old and new value. ‘
Figure 13

Realm Notification on Background Thread

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store