Beginning Realm on iOS - Part 6: Notifications | Ray Wenderlich

Add reactive features to your app using Realm's built-in notification mechanism, which will allow you to update your UI in real time as your data changes.


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/4146-beginning-realm-on-ios/lessons/6

Hi Marin, most of my apps used table view sections and collection view reusable headers. With FRC you get the indexPath that has changed, however this is not supported in Realm. You only receive the index but no section. How would you handle notification update for table view with sections?

thanks

Hey @giguerea, I am no expert but I think I know what to do.
In the exercise file Project Navigator, if you go to folder Chatter>Views you could see the extension of TableView file which is named UITableView+Ext.swift

In there you could modify the IndexPath as you want. In this exercise, the section is given default 0.
I hope it helps.

hi @giguerea the realm results themselves are not sectioned, e.g. you ask for objects of certain type and you get back a list of those object. If you’d like to split this flat list into sections according to some logic, you need to implement that same logic in your code to decide which rows in your table to update

1 Like