realm-swift
Realm is a mobile database: a replacement for Core Data & SQLite
Realm is a mobile database for iOS, macOS, tvOS, and watchOS that lets you persist Swift objects directly without writing SQL or Core Data mapping code.
Realm is a mobile database built for iOS, macOS, tvOS, and watchOS apps, designed as a replacement for Core Data and SQLite. Rather than forcing you to write complex SQL queries or mapping code, Realm lets you define your data as regular Swift classes and work with them directly as objects. This means you write far less code to store, retrieve, and update your app's data. Realm stores data directly on the device, so your app works just as well without an internet connection as it does online. One of its standout features is live objects: when data changes anywhere in your app, every part of the app that references it updates automatically, making it easy to build reactive user interfaces. Realm integrates natively with SwiftUI, so your views refresh on their own when data changes. It also supports full encryption, letting you protect sensitive data both in storage and in transit. The library can be installed through Swift Package Manager, CocoaPods, or Carthage. Important note: the sync features that connected Realm to a cloud backend were deprecated in September 2024; the core local database functionality continues to be available on the community branch or as version 20 and later. The source code is published under the Apache 2.0 license.
Where it fits
- Store and query app data locally on iOS without writing SQL
- Build a SwiftUI app whose views auto refresh when the database changes
- Replace Core Data in an existing project with a simpler object model
- Encrypt user data at rest in an iOS or macOS app