Creating CloudKit models
We will create one model together and then you will need to create the last two models needed for this chapter. When you are done creating each model, we will move on to creating our create
and fetch
methods, which we will use in the app. Before we create our models, let's create a couple of extensions that will help simplify a few things.
CloudKit extensions
If you open the project files for this chapter, in the step 1
folder, you will see a couple of files that we need. Drag all of these files into the Model
folder. Open CKContainer+Extension
and update the identifier to match your CloudKit container name:
extension CKContainer { static var shared: CKContainer { return CKContainer(identifier: “Cloudkit container name here”) } }
If you take a look in CKConstant
, you will see the following:
struct...