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].

Create a test iOS app for SQLite 1


From the menu, choose File > New > File....

Create a test iOS app for SQLite 2


Select [iOS] > [Swift File].

Create a test iOS app for SQLite 3


Create a new file named DBService.swift.

Create a test iOS app for SQLite 4


Open DBService.swift and add the following code:

import Foundation
import SQLite3

final class DBService {
    static let shared = DBService()
    
}

Create a test iOS app for SQLite 5


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”