Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firebase's iOS Offline Capabilities vs Core Data

Tags:

ios

firebase

I am developing a small set of classes that will make it easy to keep your Core Data in sync with your Firebase. But, I recently came across Firebase's iOS Offline Capabilities and I noticed, regarding data persistence, it sounds to me like similar capabilities that Core Data would provide.

As I said, I am trying to make it easy for my Core Data to stay in sync with my Firebase. How do the two differ (if at all for my case)? More specifically, will Firebase offline provide similar effects? My intentions are for a single-user app, I do not need to support multiple users simultaneously on the same app. I need the data to persist so that users can access their data offline, and between app sessions/restarts.

like image 823
nodebase Avatar asked Nov 22 '15 00:11

nodebase


3 Answers

I work at Firebase, and I once tried to do the same thing.

The Offline Capabilities of Firebase make using CoreData a bit superfluous. Firebase's offline handles a lot of the complexities like dealing with authentication offline and syncing after being offline for long period of time.

It might be useful to have a wrapper around CoreData if you really want to use the two together. However, I have found that it ends up being more complicated than it's really worth.

like image 136
David East Avatar answered Sep 19 '22 11:09

David East


As an additional answer...Both Core Data and Firebase can both store data 'offline'. They have data persistence and will enable your code to run offline transparently to the user.

To dig a bit deeper, Core Data doesn't have an 'online mode'* (built in) whereas, as soon as Firebase has a connection - wham-o, all of your offline data is now online. (*CloudKit gives CoreData that online-ness)

Additionally, Firebase has real-time data updates, so if that's what you need Firebase is the way to go for that functionality.

So for your use case, as David mentions, you are duplicating off-line functionality in many ways - especially if this is a single user only use.

If you've already got CoreData & CloudKit working, it may not be worth the time to also loop Firebase into the project - it really depends on the scope of the classes you are building.

like image 32
Jay Avatar answered Sep 20 '22 11:09

Jay


I have started with Firebase and stumbled upon these two issues that made me switch back to CoreData:

  1. No offline search - Firebase (online or offline) search is very limited, and they recommends using a third party service like Aglolia, which needs another subscription, another offline mode, another authentication etc. CoreData just supports searching via SQL like language and it is easy.

  2. No offline attachments - Firebase (real time database or cloudstore) doesn't have offline attachments feature, and Firebase Storage doesn't have an offline mode as well, so I will need to implement this on my own.

like image 38
Phuah Yee Keat Avatar answered Sep 19 '22 11:09

Phuah Yee Keat