iOS database questions


I am fairly new to the iOS development community. At this time I am working my way through the iOS and Swift apprentice books. I also started reading the Core Data by tutorials book, which raised a lot of I think fundamental questions. When browsing this site I find information about storing data. Core Data, CloudKit, SQLite, Realm and there are probably lots more ways to store data. Now although this site is loaded with tutorials on how to work with these data storages I am missing an overview of these types on when to use which type in what kind of situation.
Some work with servers, some seem to be only appropriate for storing local app data, some maybe have options to create a database which can be used by multiple users (by creating login accounts), while others just store data. Or maybe the user login part must be coded aside the data storage?
I hope there is someone who can sum up the different data storage types which are relevant today and tell me in what cases to use that type and maybe just as important what that typ is not suitable for.
I eventually want to create an app which can store and hold information about real estate objects. On one side the app would have some kind of public function to query and browse the data. On the other side the app would have a management tool to add and manipulate the data, this functionality must be shielded by a login account.
Or it can be two apps if that is more conventional.

I hope someone can help me.

1 Like

Is there no one who can help me with this?

@hannozandbergen hello, and welcome in the world of develop.

I understand your problem, but answer at your question is very hard. Let me explain:there isn’t a rule. every thing depend from what app you want to develop and what service you want to give to your users. Every service has features: Core Data make local saving of data; Cloud Kit let you share the data between iOS device with the same account and so on. For example: I’ve develop a dictionary of kanji. to do this I prefer to save the data locally. because for me share the data between iOS device by cloudkit don’t make sense. I could create a service and from this service download the data and use core data to save locally the datas or its changes.

An other app I’m developing has some data saved locally but other data are download from a web service.

As you can see, there is not a rule. An my suggestion is that: first, understand what app you want develop and try to understand what your app’s users needs. after that try to understand what service you need to give to your user these services. after that choose the most suitable service (core data, cloud kit, sqlite etc…)


I hope helped you.

p.s. Core data is a framework that is over the SQLite (to say in few word, but it’s more complicate to explain) and let you to use sqlite or the database in way more simple and easy and every record is an object Key-value. SQLite is the raw sqlite in which you need a write statement like SELECT * FROM People WHERE age >30 (for example)

1 Like

Thank you for your response! At least I learned some from your answer.
Yes it is probably a very complex question. One that has possibly an answer that can only be given by writing a small book :sweat_smile:
I thought I would just start with a more general question so I would have to make my own decision. But I realise now it is impossible to get an answer with de lines of a forum.
So…I do have in mind what services I would need from this database I am searching for:
My app needs to have a database which can hold probably thousands of records, each containing dozens of fields. Among those fields are some who have to be able to hold images and maybe other ‘strange’ data. It has to be possible to create users in the database, these users should be able to get different levels of authorisations (read only, edit and admin or something simular)
If it would serve speed or reliability it would have to have a local storage, synchronising with a serverside database.
I would prefer it if the database could later be used by maybe something like vapor.
As you said, maybe this will make it easier to get a more specific answer?

The CloudKit is a remote service that stores data in the :cloud:, hence the name, utilizing the iCloud account. If you want a cross platform solution check out firebase. Realm is a fast offline database that has java and swift/objc bindings. It is a good idea also for cross platform since the structure is the same. Majority of the time you will use CoreData since the setup is built into Xcode nicely. It will manage the underlying SQLite DB through its API.

For your specific case I would use firebase with DBstore to handle the file storage. Generally you don’t put image files in a DB but rather the path to the file on a datastore

Thank you for this information. I just read some Firebase articles and I will definitely look into it some more!