Storing data locally.
WHAT OPTIONS EXIST
Simple preference storage, for small non-sensitive values The keychain, for anything sensitive Files, written directly The object persistence framework Its modern declarative successor Third-party lightweight databases
WHAT THE PERSISTENCE FRAMEWORK PROVIDES
An object graph with relationships, querying, and change tracking.
WHAT IT COSTS
A learning curve, and concepts that surprise newcomers.
WHAT TO UNDERSTAND
Contexts, and which thread each may be used on.
WHAT CAUSES MOST PROBLEMS
Using a context from the wrong thread.
WHAT THE MODERN SUCCESSOR PROVIDES
The same capability with far less ceremony, declared on your types.
WHAT IT REQUIRES
Recent platform versions.
WHAT MIGRATIONS ARE
Defined changes to the stored model between versions.
WHY THEY MATTER ENORMOUSLY
Users upgrade with existing data, and an unhandled change loses it or crashes on launch.
WHAT TO TEST BEFORE EVERY RELEASE
Upgrading from the currently released version, with real data.
WHAT TO CONSIDER
Whether you need this at all, or whether simple files suffice.