Core Data: Beyond the Basics

Jul 26 2022 · Swift 5.5, iOS 15, Xcode 13.3.1

Part 1: Fetching & Displaying Launches

06. Modeling Relationships

Episode complete

Play next episode

Next
About this episode

Leave a rating/review

See forum comments
Cinema mode Mark complete Download course materials
Previous episode: 05. Dynamically Adjust Sort Descriptors Next episode: 07. Adding Launches to Lists

Get immediate access to this and 4,000+ other videos and books.

Take your career further with a Kodeco Personal Plan. With unlimited access to over 40+ books and 4,000+ professional videos in a single subscription, it's simply the best investment you can make in your development career.

Learn more Already a subscriber? Sign in.

Heads up... You've reached locked video content where the transcript will be shown as obfuscated text.

Your RocketLaunch app is coming along quite nicely - you can save rocket launches and mark them as viewed. But there is a pretty big limitation with the app - all launches are added to a single list. In Apple’s Reminders app, for example, you can create multiple lists each with its own set of Reminders. Let’s do the same.

@NSManaged public var launches: [RocketLaunch]
static func create(withTitle title: String, in managedObjectContext: NSManagedObjectContext) {
	let newLaunchList = self.init(context: managedObjectContext)
	newLaunchList.title = title
	
	do {
	  try managedObjectContext.save()
	} catch {
	  let nserror = error as NSError
	  fatalError("Unresolved error \(nserror), \(nserror.userInfo)")
	}
}