DEV.co
Open-Source Databases · realm

realm-swift

Realm Swift is an embedded mobile database for iOS, macOS, tvOS, and watchOS that replaces Core Data and SQLite. It provides an object-oriented data model with live objects, encryption, offline support, and native SwiftUI integration, designed to reduce boilerplate code and simplify local data persistence on Apple platforms.

Source: GitHub — github.com/realm/realm-swift
16.6k
GitHub stars
2.2k
Forks
Objective-C
Primary language
Apache-2.0
License (OSI-approved)

Key facts

Objective fields from the source. Values we can't verify are shown as “Unknown” rather than guessed.

FieldValue
Repositoryrealm/realm-swift
Ownerrealm
Primary languageObjective-C
LicenseApache-2.0 — OSI-approved
Stars16.6k
Forks2.2k
Open issues498
Latest releasev20.0.5 (2026-06-14)
Last updated2026-06-14
Sourcehttps://github.com/realm/realm-swift

What realm-swift is

Realm Swift is a cross-platform mobile DBMS written in Objective-C with Swift bindings, featuring reactive live objects, in-flight and at-rest encryption, thread-safe transactions, and built-in SwiftUI property wrappers (@ObservedResults). It uses a custom binary format optimized for mobile memory and battery constraints, installable via SPM, CocoaPods, Carthage, or XCFramework.

Quickstart

Get the realm-swift source

Clone the repository and explore it locally.

terminalbash
git clone https://github.com/realm/realm-swift.gitcd realm-swift# follow the project's README for install & configuration

Need it deployed, integrated, or customized instead? DEV.co ships production installs.

Best use cases

Offline-First Mobile Apps

Apps requiring reliable local data persistence and offline operation. Realm's on-device storage and live object synchronization make it ideal for apps that must function without network connectivity and later sync when online.

SwiftUI-Native iOS/macOS Development

Modern Swift projects leveraging SwiftUI. Native @ObservedResults integration eliminates boilerplate for reactive data binding and automatic view updates when realm data changes.

Real-Time Data-Driven Apps

Applications requiring reactive updates across multiple screens or components. Realm's live object model and change notifications enable elegant multi-observer patterns without manual state management.

Implementation considerations

  • Requires Xcode 15.3+; verify build toolchain compatibility before adoption.
  • Encryption key management is the developer's responsibility; losing or mishandling the key renders encrypted databases inaccessible.
  • Live objects hold strong references to the underlying realm instance; improper lifetime management can cause memory leaks or performance degradation.
  • Query performance depends on proper schema design and indexing; monitor for N+1 queries in notifications.
  • SwiftUI integration requires iOS 15+; legacy UIKit codebases need fallback patterns or custom bindings.

When to avoid it — and what to weigh

  • Server-Side Persistence Required — Realm Swift is a client-side embedded database. Applications requiring centralized SQL database or traditional server-backed persistence should use a backend database service instead.
  • Cross-Platform (Non-Apple) Requirement — This repository supports only Apple platforms (iOS, macOS, tvOS, watchOS). Android or web backends need separate SDKs; this does not provide a unified solution.
  • Complex SQL Queries or Reporting — Realm uses its own query language and is optimized for object-oriented access patterns. Teams heavily invested in SQL syntax, complex JOINs, or BI-style reporting may find it limiting.
  • High-Volume Concurrent Write Operations — Realm is designed for mobile single-user or light multi-user scenarios. Applications requiring high-throughput write concurrency or distributed transactions should use a traditional database.

License & commercial use

Apache License 2.0: permissive OSI-approved license permitting commercial use, modification, and distribution with attribution and liability disclaimer.

Apache 2.0 is a permissive license allowing unrestricted commercial use. Verify compliance with internal IP policies and include a copy of the license in distribution. No warranty or commercial support is implied by the license alone; MongoDB offers commercial support separately.

DEV.co evaluation signals

Editorial assessment — not user reviews. Directional, with an explicit confidence level.

SignalAssessment
MaintenanceActive
DocumentationStrong
License clarityClear
Deployment complexityLow
DEV.co fitGood
Assessment confidenceHigh
Security considerations

Realm supports field-level encryption (both in-flight and at-rest) using a 64-byte key managed by the developer. Security posture depends on: (1) secure key generation and storage (e.g., Keychain on iOS), (2) proper configuration application, (3) keeping dependencies current. Encryption implementation is not independently audited in the provided data. Threat model and compliance certifications unknown.

Alternatives to consider

Core Data

Apple's native iOS persistence framework. Offers deeper OS integration but has steeper learning curve, less intuitive API, and no built-in encryption. Suitable if strict Apple-only support and minimal external dependencies are required.

SQLite (via GRDB or sqlite3)

Lower-level relational database available on all Apple platforms. Provides more SQL flexibility and maturity but requires manual ORM, schema migrations, and thread management. Better for teams with existing SQL expertise.

CloudKit

Apple's cloud sync solution for iCloud-backed apps. No local query capability without CloudKit integration, but offers seamless Apple ecosystem sync. Use if app is exclusively Apple and iCloud sync is primary requirement.

Software development agency

Build on realm-swift with DEV.co software developers

Our mobile engineering team can assess your data persistence requirements, design a schema, and guide implementation. Get a custom recommendation.

Talk to DEV.co

Related open-source tools

Surfaced by semantic similarity across the DEV.co open-source index.

Related on DEV.co

Explore the category and the services that help you build with it.

realm-swift FAQ

Can I use Realm in production for iOS apps?
Yes. Realm is production-ready, widely adopted (16k+ stars), actively maintained, and used in many commercial apps. Monitor open issues and test thoroughly for your schema and query patterns.
Is Realm data encrypted by default?
No. Encryption is opt-in via a 64-byte key passed to Realm.Configuration. You must securely generate, store (e.g., in Keychain), and manage this key. Unencrypted realms are not encrypted.
Can I sync Realm data to a backend server?
Not built-in to Realm Swift directly. MongoDB offers Realm Sync as a paid service for bidirectional Atlas sync. Alternatively, implement custom REST/GraphQL APIs to push/pull data.
Does Realm work offline?
Yes—that is its primary design goal. All data lives on the device; apps work fully offline and can sync when reconnected (if integrated with a backend).

Software developers & web developers for hire

Adopting realm-swift is usually one piece of a larger software development effort. As a software development agency, DEV.co provides software development services and web development expertise — pairing senior software developers and web developers with your team to design, build, and operate open-source databases software in production.

Ready to evaluate Realm Swift for your iOS project?

Our mobile engineering team can assess your data persistence requirements, design a schema, and guide implementation. Get a custom recommendation.