Creating a Test iOS App for SQLite
In this article, we will create a simple iOS app to test SQLite.
We won't build a UI this time. Instead, we'll use Xcode's debugger to test creating and connecting to an SQLite database, creating tables, inserting, updating, deleting, and retrieving data.
Open Xcode and create a new project by selecting [iOS] > [App].
From the menu, choose File > New > File....
Select [iOS] > [Swift File].
Create a new file named DBService.swift.
Open DBService.swift and add the following code:
import Foundation
import SQLite3
final class DBService {
static let shared = DBService()
}
Since we'll be using the SQLite3 library, make sure to import it at the top.
That's it — we've created a test iOS app for SQLite.
In the next steps, we'll add code inside the DBService class to perform SQLite database operations and run tests.
Next article: “Create and Open an SQLite Database in Swift”