Group Group Group Group Group Group Group Group Group

Where to learn how to add a SQL database to apps in Swift 5.1?

So, I’m a beginner and want to learn how to add a relatively small database to my Swift/iOS app. I found the RW site because there is a class called " SQLite With Swift Tutorial: Getting Started" - which looked exactly what I needed… But alas, the first piece of code it hits does not work on my computer. (yes I posted here to help me get thru that issue, but got no response whatsoever… I looked thru the comments of the courses, and the moderator said that since the course was 6 months old, they were locking the thread for questions, so I think I’m out of luck with that course… I know its an older course, but it was the only hit on my google searches for SQL (which I know) and Swift (which I’m trying to learn)

That being said, I need to learn how to add a simple SQL (or whatever) database to an app in late November 2019. Everything with SQLite seems to be from 2 years ago, and requires coding updates to work in Swift 5.1 (which I just dont have the skills yet, and can’t find info)

Persistent Data seems to be a really important piece of app development, so I’m surprised there aren’t more current courses on it… Everything I read about pure SQLite (no add ons) makes it seem it is completely adequate for my needs - but I just cant find a beginners tutorial that works in Nov 2019…

Any suggestions?

@jamesh Thanks very much for your question!

I honestly smiled when I read your question because it struck such a personal chord with me!

When I first got started in iOS, I too needed a persistent layer for my project, but knew nothing of which database to use. Because I came from a Java background, I searched, and searched to find a SQL based library to use with my project, and ended up learning, and using SQLite. After the fact, I discovered that Apple provided a native persistent API for developers to use in order to achieve long term local storage for their apps. This library is called, “Core Data”. Core Data is an API built on top of SQLite, and is meant for long term persistence/storage for iOS development. There are other tools that one can use like SQLite, or other third party tools like “Realm”.

Here is a tutorial that you can go through on Core Data, and here is a tutorial on Realm.

There are other solutions out there, but you are better off using either of the above two solutions. Between the two, I personally would recommend using the native solution of Core Data simply because it’s offered from Apple, which means that it works very smoothly with other iOS components, UITableViews in particular. The API for Core Data has become much easier to use as well, which is another reason why I recommend it.

I hope this helps!

All the best!

This topic was automatically closed after 166 days. New replies are no longer allowed.