Reacting to database changes

In its current state, the MustC app doesn't update its list when a new managed object is persisted. One possible solution for this is to manually reload the table right after a new family member is inserted. Although this might work well for some time, it's not the best solution to this problem. If the app grows, you might add a functionality that imports new family members from the network. Manually refreshing the table view would be problematic because the networking logic should not be aware of the table view. Luckily, there is a better solution to react to changes in your data.

One way to respond to database changes is using NSFetchedResultsController. This object is perfect for listening to the insertion of new family members. A second way to respond to notifications is through notifications. You will implement this approach in MoviesViewController.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset