mardi 18 août 2015

Is it better to use prebuilt DB or build on the fly? - Swift and FMDB

I am getting to the stage where I need to consider the data storage of my app. The app will allow users to create an account, sign in and perform a range of tasks.

I am using FMBD with SQLite but I would like some ideas (if OK) on what the best methods would be to achieve the below.

I am considering whether to create a file and import that in to my project. The file would be the DB created outside of the app with all the tables and relationships. Then use FMDB to query.

The other option is the have the app create the tables if they do not exist and then use FMDB to query.

There will also be an API to allow syncing of information to and from a server to allow web access. I am considering using SwiftyJSON for this (or is there no need)?

When a user first creates an account, the app queries the API to check if the user exists. If not, adds the user and sends back their new ID. This ID is then used to query all other data in the DB both locally and through the API.

Or do I even need a local DB? Or would it be better to use something like Alamofire?

This seems like a very broad question but I just want to make sure I have the right information as I have done a lot of searching but still no closer to a solid solution yet.

Many thanks

Aucun commentaire:

Enregistrer un commentaire