Choosing Local DB Storage for Beginning IOS using Object C


#1

Id like to know what db/storage/persistence is used now in the industry.

What would be a good db to start since I am new in IOS development.

I have been an Android Developer for a long time so I ve been accustomed with SQLite.

I have been reading about Core Data, Realm, SQLite as possible start.

Any insights and recommendations?


#2

I suggest go with Core Data since you are new in iOS Development.

As a developer new in iOS, I suggest stick to the core / native approaches first before exploring 3rd party solutions.


#3

@duram

Thank you for your insight.

Trying Core Data earlier today but it seemed not to be too beginner friendly, I think.

I started a project using a tutorial i followed in apple but apparently Core Data was not initially set up, so I went to stack overflow and now following how to add Core Data to the project and im a bit lost in it.

This is the link im following


#4

@MacadamiaPH

That link’s a little out of date (but still works). You can use this tutorial if you’re planning on targeting iOS 10. It’s a lot easier to set-up using NSPersistentContainer:

Core Data uses SQLite as its persistent store by default. It’s also built-in to the iOS SDK so most projects use it.

If you don’t mind having an external dependency and managing it (via cocoapods), I think Realm and Firebase are great with a simpler API.


#5

@mark_jimenez

Thank you for your feedback.

Im actually trying Core Data, and the link you mentioned would work if I am working from scratch.
Unfortunately, I want to continue what I’ve started and i am trying to add Core Data to an existing project and I am stuck because I still lack the mastery to fully comprehend all the instruction on the link i gave.


#6

Hi, if you are starting a new project with Core Data, I encourage you to use an existing wrapper library to help you avoid common pitfalls.
Personally I would recommend CoreStore (https://github.com/JohnEstropia/CoreStore)
mainly because I maintain this project :grin:

Feel free to join the CoreStore Slack group here: http://swift-corestore-slack.herokuapp.com/


#7

@john.estropia thanks for the recommendation. Id like to understand and learn how the “old way” first in order to understand IOS better.

Ive booked marked the link you ve given me so I can read it and use it on future projects.


#8

No problem. That’s a good mindset.
CoreStore is just a layer on top of CoreData, so you can always use it with your existing models anytime you feel comfortable.
Regardless, feel free to ask anything anytime. :+1: Goodluck!


#9

@MacadamiaPH

If you want to understand old school Core Data stack, here’s a good intro describing all the components.

https://www.objc.io/issues/4-core-data/core-data-overview/

A lot of the code in the old core data stack is boilerplate since most of it is for setting-up the stack. You’ll most likely work with NSManagedObject and NSManagedObjectContext most of the time in code, and the data model file for creating models and relationships.

Once, you’ve understood that, NSPersistentContainer is a new API in iOS 10 and encapsulates a lot of the boilerplate.

@john.estropia

Core Store is seriously impressive. This is probable the most comprehensive Core Data swift wrapper I’ve seen. Even includes wrappers for migrations! Great job on this. Will consider it using it on new projects if I ever go back to Core Data.


#10

Hi @MacadamiaPH Thanks for posting questions. Just wanted to ask that you mark which reply solved your problem or which one is the most useful to you. This will be helpful to the community and visitors of the thread. :slight_smile:


#11

Thanks. Ill keep that in mind.