From the course: Learning Realm for iOS App Development

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Your first model

Your first model - iOS Tutorial

From the course: Learning Realm for iOS App Development

Start my 1-month free trial

Your first model

- [Instructor] We are now going to create our first Realm data model and therefore, I've already opened up our Realm project where we have added the Realm framework and prepared everything so that we can get started right away. And, to add my model, I'm going to select App Delegate so that a new file is added right below. Pressing Command + N on the keyboard, select my empty Swift file, and I'm going to call my model file just model, and hit the create button. And, in this empty Swift file, we already imported Foundation. This is done automatically. But, what we also need to do in order to create our model and to work with Realm is importing Realm Swift. And, now we can start creating our model with the creation of a simple class. Just as you would create any other class. So, we want to create a model for Notes application. So, I'm going to call this class Note and the super class for this Note class is going to be Object. And, this is a class used to define a Realm model object. So…

Contents