ShapeShapeGrouppointGroupchapter-listShapeShape Copy 12ShapeShape Copy 3ShapeGroupShapedropdowneditoreditorCombined ShapegridShape Copy 4Shape Copy 7ShapelanguagelanguageShapemegaphonepaperbackShapeplatformnoun_419259-2 copyplay-iconBS-Question-Rounded-Circlequotesnoun_610406stacked-books-1stacked-books-2Shape Copy 5 Combined Shape Group Group Group Group Group Group Group Group Group Group Group Group Group Group Group Group Group
Realm: Building Modern Swift Apps with Realm Database book cover
New

Realm: Building Modern Swift Apps with Realm Database

$54.99
  • Platform iOS 11
  • Language Swift 4.1
  • Editor Xcode 9.3

In this Realm book, you'll learn how to build modern Swift apps with the persistence and synchronization of Realm Database and Realm Cloud.

Developer Guide

Advanced

For advanced iOS developers
Realm: Building Modern Swift Apps with Realm Database book cover

Create powerful, reactive iOS apps with Realm Database and Realm Cloud!

Realm finds the sweet spot between the simplicity of storing data as JSON on disk and using heavy, slow ORMs like Core Data or similar that are built on top of SQLite. The Realm Database aims to be fast, performant and provide the commodities that mobile developers need such as working with objects, type-safety, and native notifications. Realm Database has been under active development for several years. It powers apps by some of the biggest names in the App Store, including Adidas, Amazon, Nike, Starbucks, BBC, GoPro, Virgin, Cisco, Groupon, and many more who have chosen to develop their mobile apps with Realm.

Realm Platform is a relatively new commercial product which allows developers to automatically synchronize data not only across Apple devices but also between any combination of Android, iPhone, Windows, or macOS apps. Realm Platform allows you to run the server software on your own infrastructure and keep your data in-house which more often suits large enterprises. Alternatively you can use Realm Cloud which runs a Platform for you and you start syncing data very quickly and only pay for what you use.

In this 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. In the last chapter of this book, you'll take a look at the synchronization features of Realm Cloud to perform real-time sync of your data across all devices.

We also recommend

Table of Contents

1.

Hello Realm!

Realm finds the sweet spot between the simplicity of storing data as JSON on disk and using heavy, slow ORMs like Core Data or similar that are built on top of SQLite. In this book you are going to learn plenty about Realm, how to build iOS apps with Realm, and you’ll pick up some tips and tricks along the way about getting the most out of the platform.

2.

Your First Realm App

In the previous chapter, you learned about the Realm Database, how it works and what problems it can solve for you as a developer. 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.

3.

Object Basics and Data Types

You now have a grasp of the easy and clean way of writing Realm-related code. In this chapter, you’ll dive deeper into Realm’s Swift API and go over many of the available classes and their methods in order to get a solid understanding of Realm’s superpowers, as well as some of its limitations.

4.

Schema Relationships

You’ve mastered your object-type properties and your primitives, learned how to add a primary key and indices, and other important details. Your data, however, isn’t isolated when in a Realm. You can have many different objects connected to each other in all sorts of useful and meaningful ways. This chapter will teach you all about building powerful and efficient relationships between objects.

5.

Reading and Writing Objects

You’ve had a sneak peek into persisting objects and reading them back, but you barely scratched the surface of dealing with stored objects, as you’ll realize in this chapter. In the first half of this chapter you’ll look into fetching, querying, and sorting persisted data from Realm. In the second half, you will cover the Realm APIs that let you add, update, and delete objects in your Realm.

6.

Notifications and Reactive Apps

You are probably eager to use the in-depth knowledge you soaked up working through the last few chapters in practice, and rightfully so. In this chapter, you’ll learn about Realm’s built-in notification APIs. Realm features a rather clever system of detecting any changes, regardless of the thread or process responsible for those changes, and deliver notifications to any observers.

7.

Realm Configurations

In this chapter that covers Realm configurations, you’ll take a step back (or is it one forward?), dig into working with the Realm class itself, and learn about how to configure Realm using Realm.Configuration. You’ll learn how to work with different Realm files on disk and in-memory, as well as how to use advanced features such as data encryption.

8.

Multiple Realms / Shared Realms

In this chapter, you’re going to make use of your existing Realm skills while learning some new ones. You’re going to use multiple configurations, read and write data, use notifications to build reactive UI, and explore new topics like sharing data between your app and a Today extension.

9.

Dependency Injection and Testing

In this chapter, you’re going to touch on two important topics: how to use dependency injection to improve the architecture of your Flash Cards apps, and how to write both synchronous and asynchronous tests powered by Realm. This chapter won’t delve into topics such as test driven development, but will instead focus specifically on tips and tricks for testing classes that use Realm objects and depend on Realm-specific functionality such as change notifications.

10.

Effective Multi-threading

Many of the issues you would experience with database ORMs and/or other databases are rooted in asynchronous, multi-threaded code. Accessing your data from concurrent threads in an efficient and safe manner is, unsurprisingly, not very straightforward and quite error-prone. Realm saves you from the hassles of over-thinking concurrent threads, since it’s been planned with a deeply integrated multi-threading strategy which makes concurrent access to the database a walk in the park.

11.

Beginning Realm Migrations

Nothing in life (and code) remains static forever. So what happens, then, when the app you’re working on becomes wildly successful and you need release a new version, and then another one, and another one? In this chapter you’ll learn how you can migrate the schema of a Realm file as it evolves alongside your app.

12.

Advanced Schema Migrations

In this chapter, you’re going to build a more complex migration in an Xcode project. The demo is designed in such a way that you can build three different versions of the same app. This will allow you to write code and simulate real-life app upgrades, all from the comfort of a single Xcode project.

14.

Real-Time Sync with Realm Cloud

In this chapter, you’re going to build a more complex migration in an Xcode project. The demo is designed in such a way that you can build three different versions of the same app. This will allow you to write code and simulate real-life app upgrades, all from the comfort of a single Xcode project.

Meet the author

Marin Todorov iOS Team

Customer reviews

Realm: Building Modern Swift Apps with Realm Database

I wish this book was available two years ago when I just started using Realm. Would recommend it to anyone using or thinking about using Realm, a true source of truth for our entire team.

Matan Cohen

Despite the fact we previously worked with Realm never before it was so accessible and easy to understand. Great to dive in to and great to keep at your desk for easy reference.

Michal Shatz

From the basics up to more advanced scenarios, this book covers everything an iOS developer needs in order to write simple or complex apps using Realm, and I totally recommend it!

Nathan Rolnik
Realm: Building Modern Swift Apps with Realm Database book cover

Get Realm: Building Modern Swift Apps with Realm Database

Create powerful, reactive iOS apps with Realm Database and Realm Cloud!

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. You'll also take a look at the synchronization features of Realm Cloud to perform real-time sync of your data across all devices.

Top