Core Workflow: Define, Open, and Manage Data
communityThe Realm Swift SDK follows a standard lifecycle for data management:
- Define an Object Schema: Use idiomatic Swift to define your data models.
- Open a Database: Open a Realm database stored in a file on the device, or open an in-memory database if persistence is not required.
- Read and Write Data: Perform CRUD (Create, Read, Update, Delete) operations. You can filter data using the type-safe
.wheresyntax or by constructing anNSPredicate. - React to Changes: Use notification handlers to watch for changes in live objects, or use SwiftUI property wrappers to automatically update your UI when data changes.