

If you run the starter app right now, you’ll see that it compiles and displays an empty to-do list on screen: We’ve provided it as a guideline so you’ll know where to look for files as later projects in this book become more complicated.
Simpholders free code#
The projects in this book all follow a similar code structure, but you aren’t forced to use this structure in your own work. In later chapters, you’ll be working on more complex database schemas, but this simple schema will suffice for now. You have a single class called ToDoItem in this project. This is practically your data models, but backed by Realm.

This will be very useful as you learn the basics of CRUD operations with Realm. In this chapter, you’re going to work on a to-do app that’s built on the Realm Database. A to-do app includes features like fetching a list of to-do items from disk, adding, modifying and deleting items, and using the data with some of the common UIKit components such as a table view, an alert view, buttons, and more.
Simpholders free how to#
The theme of to-do apps as an educational tool might be getting old by now, but the simple truth is that a to-do app does a great job of demonstrating how to build an app based on data persistence. This chapter is simply about getting a feeling for using Realm in your Swift code. I invite you to work through this chapter’s exercises with an open mind. You’re going to learn the mechanics behind everything you’re about to do in this chapter and much, much more. Have no fear though, as the rest of this book will teach you just about everything there is to learn about Realm in detail. Now you’ll take a leap of faith and dive right into creating an iOS app that uses Realm to persist data on disk while following this tutorial-style chapter. This will hopefully inspire you to try and find the right APIs, figure out what they do, and perhaps even browse through RealmSwift’s source code. The idea of this chapter is to get you started with Realm without delving too much into the details of the APIs you’re going to use. You’ll also take a look at the synchronization features of Realm Cloud to perform real-time sync of your data across all devices. In the book, you’ll take a deep dive into the Realm Database, learn how to set up your first Realm database, see how to persist and read data, find out how to perform migrations and more.


This is an excerpt taken from Chapter 2, “Your First Realm App” of our book Realm: Building Modern Swift Apps with Realm Database.
