I want to add my own Database named Photos.sqlite to my iOS application. I have the following code to open the database, but is this creating a database named Photos.sqlite, and not using my own?
func createDB() -> OpaquePointer?{
let filePath = try! FileManager.default.url(for: .documentDirectory, in: .userDomainMask, appropriateFor: nil, create: true).appendingPathExtension(path)
var db : OpaquePointer?
guard sqlite3_open(filePath.path, &db) == SQLITE_OK else {
print("error opening database")
sqlite3_close(db)
db = nil
return nil
}
return db
}
I am asking how would I use my own database within the application? Where would I put the file? I did a bit of research and it states the Photos.sqlite must be in documents but I do not think I need this since I will only be reading data from the database, I will not be inserting or updating the database in any way.