realm-persistence
Installation
SKILL.md
Realm Persistence for iOS
Overview
Realm's thread-confinement model conflicts with Swift Concurrency's thread-hopping. The zero-copy architecture delivers fast reads but causes memory traps in extensions. Wrong patterns cause "accessed from incorrect thread" crashes.
Core principle: Fresh Realm per actor method, batch all writes, never pass objects across threads, avoid Realm in memory-constrained contexts.
Threading Model
Critical Rule: Thread-Confined Objects
Realm objects CAN ONLY be accessed on the thread where Realm was created.