iOS Data Storage: Classify Your Data Before You Choose a Database
When a new iOS project needs local data storage, the discussion often starts with questions like these:
Is SwiftData production-ready?
Should we use Core Data instead?
Would GRDB give us more control?
These are reasonable questions, but they should not be the team's starting point.
Before choosing a framework, we need to understand:
- what data the app will store;
- how long it should persist;
- whether it is sensitive;
- whether it can be downloaded again;
- whether it must remain available offline;
- whether it must be synchronized between devices.
A real application rarely has a single type of data. UI preferences, authentication tokens, domain models, user-generated files, and temporary network responses all have different lifecycles.
Putting everything into one database because it is technically possible has a cost, and the cost never arrives on the day you make the decision.
It arrives when the product asks for sync and the schema will...
Copyright of this story solely belongs to hackernoon.com. To see the full text click HERE