❗️Save and Retrieve any thing in JUST ONE line of code❗️
Fast usage dataBase to avoid struggling with dataBase complexity. Just save every object with a simple function.
Other languages: (中文)
The QuickDB uses CoreData with a SUPER easy use case that you can store any codable objects and query for them in just 1 line of code. This component is highly recommended for small scale applications to store user data and settings with custom class types.
Step 1:
Confirm your codable to have a UUID with protocol QuickIndexable
struct MyModel: QuickIndexable {
var uid = UUID()
...
}
Step 2:
Save your object to QuickDB
QuickDB.shared.insert(model: myModel)
Step 3:
Retrieve all your objects from QuickDB
QuickDB.shared.getAll(LatestObjects: { (items: [MyModel]) in
//use your inserted items here
print(items)
}) { (error) in
print(error)
}
QuickDB uses generic functions to query all records that matches with your Model type.self
💢 Check the example to see how you can bachInsert
, delete
, update
and tag
your models.
💢 There are usecases that optimized for storing large files like Image
, Audio
, etc.
Store An Image:
UIImage(imageLiteralResourceName: "Image").pngData()?.asQuickFile(fileName: "MyImage").store()
Step 1:
Save your Data object:
Data().asQuickFile(fileName: "MyData").store()
Step 2:
Load your saved Data:
QuickDB.shared.data(fileName: "MyImage", fileType: .png) { (items) in
//items is an array of [Data] matches with your file name
}
💢 QuickFM save any files in the QuickDBStorage folder inside your device, you can get all saved files inside the function of QuickDB.shared.getAll(LatestObjects: { (items: [QuickDataRecord]) in}
.
💢 QuickFM allows you to save Data objects with same fileNames and retrieve all of them in data(fileName:fileType:completion)
.
To run the example project, clone the repo, and run pod install
from the Example directory first.
iOS +11.0 swift 5.0 xcode +11
QuickDB is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'QuickDB'
behrad-kzm, [email protected]
QuickDB is available under the MIT license. See the LICENSE file for more info.