I'm planning to use SwiftData for local storage in my iOS app. The data model will include hundreds of different object types, many of which are related (e.g. Object A is made up of Object B, Object C, and some primitive fields). There will be thousands of these kind of "records" overall.
The key thing is that this data is mostly static... Small amout of data will change every week or so. Users will only read the data, and they won’t be updating or deleting anything, so its only admin who will change the data (also, admin should have easy way to change database).
So here’s what I’m thinking:
- Initially fetch the full dataset from a remote database.
- When something changes in the database, send a push notification to the app
- On receiving the notification, fetch only the the minimal branch of a database ( probably would use lastUpdatedAt field for this)
- All searching, querying, etc., would be done locally.
Does this sound like a good approach for syncing kinda large but rarely changing databases? Are there best practices for managing this kind of setup?
I was thinking about FireStore, but since I wouldn't use most of its features cause everything will be done locally, I am not sure if that's the way to go... Also this way, I expose whole database to the (malicious) users.
On the other hand, if I use remote database to fetch required data, I will likely make high bandwith due to high traffic and the way of app will be likely used...
I wonder what is general way to go with apps like this...
Would appreciate any tips and suggestion!