Chapter 5. 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 11 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 when you enter your product’s name in Xcode’s new project dialog, as shown in Figure 5-1. Core Data is one of the three features you can choose at the bottom of the dialog.
5.1 Designing Your Database Scheme
You want to begin storing data in Core Data.
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.
Ensure that you have added Core Data to your project by following the instructions given in this chapter’s ...