Creating a Core Data manager

You have created the Core Data entities required to save reviews and photos, and you have created the corresponding model objects. Now, you will create a CoreDataManager class that will set up the Core Data components for your app. Perform the following steps:

  1. Right-click the Core Data folder inside the Misc folder and choose New File.
  2. iOS should already be selected. Choose Cocoa Touch Class and then click Next.
  3. Configure the file as follows:
  • Class: CoreDataManager
  • Subclass: NSObject
  • Also create XIB: Greyed out
  • Language: Swift
  • Then, click Next
  1. Click Create. CoreDataManager.swift appears in the Project navigator.
  2. Add the following code after the import statement:
import CoreData

This gives you access to ...

Get iOS 13 Programming for Beginners - Fourth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.