Skip to Content
iOS 10 Swift Programming Cookbook
book

iOS 10 Swift Programming Cookbook

by Vandad Nahavandipoor
December 2016
Intermediate to advanced content levelIntermediate to advanced
456 pages
8h 46m
English
O'Reilly Media, Inc.
Content preview from iOS 10 Swift Programming Cookbook

Chapter 4. Core Data

Every application needs to store information, whether during the course of a single session or permanently. To aid in the difficult task of managing and searching stored data, Apple has developed a whole framework called Core Data, which you might already be familiar with. In iOS 10 SDK, Core Data, especially in Swift, has been changed a little bit, so in this chapter we will have a look at these changes as well as some basics of accessing Core Data.

Before we go further, ensure that you have added the necessary Core Data code to your application. When you create your project file, make sure to tell Xcode to import Core Data into your application. You do this where you enter your product’s name in Xcode’s new project dialog, as shown in Figure 4-1. Core Data is one of the three features you can choose at the bottom of the dialog.

Figure 4-1. At the bottom of this dialog, you can ask Xcode to add Core Data to your project

4.1 Designing Your Database Scheme

Problem

You want to begin storing data in Core Data.

Solution

The idea behind Core Data is that your data is organized and stored in the database through what are known as schemes. Schemes tell Core Data how your data is structured, and can be designed through a visual editor that’s part of Xcode.

Note

Ensure that you have added Core Data to your project by following the instructions given in this chapter’s ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

iOS 11 Swift Programming Cookbook

iOS 11 Swift Programming Cookbook

Vandad Nahavandipoor
iOS 7 Programming Cookbook

iOS 7 Programming Cookbook

Vandad Nahavandipoor

Publisher Resources

ISBN: 9781491966426Errata PageSupplemental Content