About OLCOrm
OLCOrm is a lightweight Object-Relational Mapping (ORM) library for iOS and macOS development. It provides a simple and intuitive way to interact with databases, allowing developers to seamlessly integrate data storage functionality into their applications.
Key Features
- Simplified database interaction
- Automatic object-relational mapping
- Secure and efficient data storage
- Support for multiple database systems
- Lightweight and easy to use
Getting Started
To start using OLCOrm in your iOS or macOS project, follow the steps below:
- Install OLCOrm using CocoaPods or manually by adding the framework to your project.
- Import the OLCOrm module in your source files.
- Define your model classes that inherit from OLCOrmObject.
- Implement the required methods for your model, such as mapping properties to database columns.
- Perform database operations using the provided OLCOrm methods.
Sample Code
class User: OLCOrmObject {
// Define properties
var id: Int = 0
var name: String = ""
var email: String = ""
// Map properties to database columns
override func mapping() -> [String: String] {
return [
"id": "user_id",
"name": "user_name",
"email": "user_email"
]
}
}
// Retrieve all users from the database
let users = OLCOrm.query(User.self)
// Create a new user
let newUser = User()
newUser.name = "John Doe"
newUser.email = "john.doe@email.com"
newUser.save()
// Update an existing user
if let existingUser = OLCOrm.query(User.self, withPrimaryKey: 1) {
existingUser.name = "Updated Name"
existingUser.save()
}
// Delete a user
if let userToDelete = OLCOrm.query(User.self, withPrimaryKey: 2) {
userToDelete.delete()
}
The above code demonstrates a basic usage scenario with OLCOrm. You can define your model class, specify the database columns using the mapping method, and perform various database operations such as querying, saving, updating, and deleting objects.
Documentation
For detailed documentation on how to use OLCOrm, please refer to the official OLCOrm documentation at the CocoaDocs website.
Support
If you encounter any issues or need assistance, you can get support by contacting our support team or by visiting our community forums.