Created
June 8, 2019 05:11
-
-
Save identity2/d6fb7d59a26422844936b33634da3f33 to your computer and use it in GitHub Desktop.
Database Accessor 2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class DatabaseAccessor { | |
static let sharedInstance = DatabaseAccessor() | |
private init() {} | |
// The instance of the SQLite database | |
private var mainDB: FMDatabase? | |
public func initializeDatabase() { | |
let databasePath = (dirPath as NSString).appendingPathComponent("database.sqlite") as NSString | |
// Assign the instanced database. | |
mainDB = FMDatabase(path: databasePath as String) | |
} | |
public func closeDatabase() { | |
mainDB?.close() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment