Database Reference
In-Depth Information
( coreDataStack.context ) uses. Any UI operation, such as creating the fetched
results controller for the table view, must use a context of this type.
Now that you've moved the export operation to a new context with a private queue,
it's time to build and run and see if it works! Give it a go.
You should see exactly what you saw before:
Tap the Export button in the top-left and then immediately try to scroll the list of
surf session journal entries. Notice anything different this time? The export
operation still takes several seconds to complete, but now the table view continues
to scroll during this time. The export operation is no longer blocking the UI.
Cowabunga, dude! Gnarly job making the UI more responsive.
You've just witnessed how creating a new managed object context with a private
queue can improve a user's experience with your app. Now let's expand on the use
of multiple contexts by examining a child context.
Editing on a scratchpad
Right now, Surf Journal uses the main context ( coreDataStack.context ) when
viewing a journal entry or creating a new journal entry. There is nothing wrong with
this approach; the starter project works as-is.
But for some apps, such as notes or journal entry apps, you can simplify the app
architecture if you think of edits or new entities as a set of changes, like a scratch
 
Search WWH ::




Custom Search