SQLite: Local Database | Swift 4, Xcode 9

Kilo Loco · 87K views · 2017 · 43:36

Open on YouTube

Databases & storageSoftware (other)tutorialdated

Why Stack Overflow recommends it

Stack Overflow users link it as a hands-on walkthrough when asked how to set up and use SQLite in a Swift iOS project.

Recommended by 1 people across 1 different months, 2017 to 2019.

What it is

A 43-minute iOS tutorial by Kilo Loco on saving data to a local SQLite database from a Swift 4 and Xcode 9 app. It covers the basics of creating, reading, updating and deleting rows, and contrasts raw SQLite with Core Data. The finished project is published on GitHub.

What people said

Recommends Elivan K. · 2017-08 · Stack Overflow · on “No Such Module like Sqlite in Swift”

It took some time but here is the answer: 1. Need to download the file sqlite.swift-master.zip Downlod from here [LINK] 2. Unzip it and drag the SQLite.xcodeproj file into your own project. 3. In your target’s General tab, click the + button under Linked Frameworks and Libraries, add the sqlite framework for ios and in the Embedded Binaries the sqlite.framework. Here is a nice video that helps: [this video]

Cites OrajokNor · 2019-03 · Stack Overflow · on “Unable to get the value back from a function to assign it to a label”

Write your function similar to this func FoodItemAdded(Food: String)->String { //setting the parameter value to a variable let string = Food //returning new string type variable return string } You can set the return value to a label like this, self.mylabel.text = FoodItemAdded("Burger") To store data, you can use core data/ SQLITE. Coredata: [LINK] Sqlite: [this video]

Cites JerseyDevel · 2019-10 · Stack Overflow · on “SwiftUI SQLite ForEach list data”

I am trying to integrate an SQLite database (with SQLite.swift) [LINK] into my project (since my unrecovered apparent limitations of CoreData referenced here [LINK] . Ive got a helper file with a class that I instantiate to do all of the heavy lifting with regards to SQLite queries. I can not figure out how to get that data, let's say a simple list of the contents of the database, into a ForEach statement in SwiftUI. I have tried to set a return from the function that runs the query, but its return type is AnySequence<Row> , and I'm not sure what to do with that. When I try to return it after the data is fetched, I get errors about not returning is on failure (understandably so). Don't know