SQLite SingleManagerClass and use of FMDB
- SingleTonManager class
- Swift language
- Use of FMDB
- Create database
- Insert, update, delete & select operations
- Create your .db file
- Add freamework libsqlite3.tbd
- Drag and drop LocalDatabase.swift file into your project
LocalDatabase.sharedInstance.methodToCreateDatabase()
LocalDatabase.sharedInstance.methodToInsertUpdateDeleteData("INSERT INTO CONTACTS_TABLE (name, address, phone) VALUES ('Satyam Mall', 'Brainvire', 0085)", completion: { (completed) in
if completed
{
print("Data updated successfully")
}
else
{
print("Fail while data updation")
}
})
LocalDatabase.sharedInstance.methodToSelectData("SELECT * FROM CONTACTS_TABLE", completion: { (dataReturned) in
print(dataReturned)
})