All Projects → arturdev → Unrealm

arturdev / Unrealm

Licence: mit
Unrealm is an extension on RealmCocoa, which enables Swift native types to be saved in Realm.

Programming Languages

swift
15916 projects
enum
40 projects

Projects that are alternatives of or similar to Unrealm

Laravel Db Profiler
Database Profiler for Laravel Web and Console Applications.
Stars: ✭ 141 (-66.82%)
Mutual labels:  database, db
Tiedot
A rudimentary implementation of a basic document (NoSQL) database in Go
Stars: ✭ 2,643 (+521.88%)
Mutual labels:  database, db
Sqldb Logger
A logger for Go SQL database driver without modify existing *sql.DB stdlib usage.
Stars: ✭ 160 (-62.35%)
Mutual labels:  database, db
Vuerd Vscode
ERD Editor vscode extension
Stars: ✭ 95 (-77.65%)
Mutual labels:  database, db
Crate
CrateDB is a distributed SQL database that makes it simple to store and analyze massive amounts of data in real-time.
Stars: ✭ 3,254 (+665.65%)
Mutual labels:  database, db
Node Mysql Utilities
Query builder for node-mysql with introspection, etc.
Stars: ✭ 98 (-76.94%)
Mutual labels:  database, db
Db
Data access layer for PostgreSQL, CockroachDB, MySQL, SQLite and MongoDB with ORM-like features.
Stars: ✭ 2,832 (+566.35%)
Mutual labels:  database, db
Gorose
GoRose(go orm), a mini database ORM for golang, which inspired by the famous php framwork laravle's eloquent. It will be friendly for php developer and python or ruby developer. Currently provides six major database drivers: mysql,sqlite3,postgres,oracle,mssql, Clickhouse.
Stars: ✭ 947 (+122.82%)
Mutual labels:  database, db
Lazer Database
PHP flat file database to store data with JSON
Stars: ✭ 254 (-40.24%)
Mutual labels:  database, db
Android-ORM-Benchmarks
No description or website provided.
Stars: ✭ 25 (-94.12%)
Mutual labels:  realm, db
Laravel Log To Db
Custom Laravel and Lumen 5.6+ Log channel handler that can store log events to SQL or MongoDB databases. Uses Laravel/Monolog native logging functionality.
Stars: ✭ 76 (-82.12%)
Mutual labels:  database, db
Bitraft
🎉A Bitcask Distributed Key/Value store using Raft for consensus with a Redis compatible API written in Go.
Stars: ✭ 348 (-18.12%)
Mutual labels:  database, db
Topaz
A simple and useful db wrapper for Crystal-lang
Stars: ✭ 56 (-86.82%)
Mutual labels:  database, db
Sqift
Powerful Swift wrapper for SQLite
Stars: ✭ 119 (-72%)
Mutual labels:  database, xcode
Rxrealm
RxSwift extension for RealmSwift's types
Stars: ✭ 1,007 (+136.94%)
Mutual labels:  database, realm
Vuerd
ERD Editor
Stars: ✭ 208 (-51.06%)
Mutual labels:  database, db
Android dbinspector
Android library for viewing and sharing in app databases.
Stars: ✭ 881 (+107.29%)
Mutual labels:  database, db
Spimedb
EXPLORE & EDIT REALITY
Stars: ✭ 14 (-96.71%)
Mutual labels:  database, db
Jaydebeapi
JayDeBeApi module allows you to connect from Python code to databases using Java JDBC. It provides a Python DB-API v2.0 to that database.
Stars: ✭ 247 (-41.88%)
Mutual labels:  database, db
Awesome Cheatsheets
👩‍💻👨‍💻 Awesome cheatsheets for popular programming languages, frameworks and development tools. They include everything you should know in one single file.
Stars: ✭ 26,007 (+6019.29%)
Mutual labels:  database, xcode

Unrealm Header Logo



Swift 5.1 Build Status Version Platform License Platform Platform


Unrealm enables you to easily store Swift native Classes, Structs and Enums into Realm .
Stop inheriting from Object! Go for Protocol-Oriented programming!
Made with ❤️ by arturdev



Features

Unrealm supports the following types:

  • [x] Swift Primitives
  • [x] Swift Structs
  • [x] Swift Classes
  • [x] Swift Enums
  • [x] Swift Arrays
  • [x] Swift Dictionaries
  • [x] Nested Classes/Structs
  • [x] Swift Optionals (String, Data, Date)
  • [x] Swift Optionals of primitives (Int, Float, Double, Bool)
  • [x] Swift Optionals of Realmables
  • [x] Swift Optionals of Arrays
  • [x] Swift Arrays of enums

Example Project

To run the example project, clone the repo, and run pod install from the Example directory first.
See also Unit Tests.

Usage

All you have to do is

  1. Conform your Classes/Structs to Realmable protocol instead of inheriting from Object. Conform your Enums to RealmableEnum protocol.
  2. Register your Classes/Structs and Enums in AppDelegate's didFinishLaunchingWithOptions.
Realm.registerRealmables(ToDoItem.self)

Thats it! Now you can store your Struct or Class object into Realm as usualy you do with Objc Classes.

Pros and Cons

Pros 🎉

  • Enables you to store Swift native types (Structs, Classes, Enums, Arrays, Dictionaries, etc...)
  • Getting rid of redundant inheriting from Object class
  • Getting rid of Realm crashes like "Object has been deleted or invalidated"
  • Getting rid of Realm crashes like "Realm accessed from incorrect thread"
  • Getting rid of boilerplate code such as @objc dynamic var. Use just var or let
  • Getting rid of boilerplate code such as RealmOptional<Int>. Use just Int?
  • Works perfect with Swift's Codable and optional types!

Cons 🍟

  • Losing "Live Objects" feature. Which means when you modify an object got from Realm the other ones will not be updated automatically. So after modifying an object you should manually update it in realm. f.e.;
let realm = try! Realm()
var todoItem = realm.object(ofType: ToDoItem.self, forPrimaryKey: "1")
todoItem.text = "Modified text"
try! realm.write {
realm.add(todoItem, update: true) //<- force Realm to update the object
}

Installation

CocoaPods

Unrealm is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'Unrealm'

Swift Package Manager

You can also use Swift Package Manager to add Unrealm as a dependency to your project. In order to do so, use the following URL:

https://github.com/arturdev/Unrealm.git

You need to use "SPM" branch instead of master.

ToDos

  • Add more UnitTests
  • Create a sample project for Swift Package Manager when dependencies can be added to many targets in a simple project.

Contribution

⭐️ If you like what you see, star us on GitHub.

Find a bug, a typo, or something that’s not documented well? We’d love for you to open an issue telling me what I can improve!

Contributions are welcome, and they are greatly appreciated!

Author

arturdev, [email protected]

License

Unrealm is available under the MIT license. See the LICENSE file for more info.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].