{"id":1017,"url":"https://github.com/matghazaryan/Unrealm","last_synced_at":"2025-08-06T13:32:11.512Z","repository":{"id":45061321,"uuid":"189771488","full_name":"matghazaryan/Unrealm","owner":"matghazaryan","description":"Unrealm is an extension on RealmCocoa, which enables Swift native types to be saved in Realm.","archived":false,"fork":false,"pushed_at":"2024-08-31T18:48:09.000Z","size":39729,"stargazers_count":538,"open_issues_count":18,"forks_count":74,"subscribers_count":13,"default_branch":"master","last_synced_at":"2024-11-21T06:37:28.672Z","etag":null,"topics":["database","db","enum","ios","realm","realmswift","struct","swift","xcode"],"latest_commit_sha":null,"homepage":null,"language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/matghazaryan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-06-01T19:43:30.000Z","updated_at":"2024-11-08T02:09:01.000Z","dependencies_parsed_at":"2024-06-18T18:22:32.623Z","dependency_job_id":"fa6383a4-89be-4ea7-8b71-46ec207f54d7","html_url":"https://github.com/matghazaryan/Unrealm","commit_stats":{"total_commits":82,"total_committers":6,"mean_commits":"13.666666666666666","dds":0.1585365853658537,"last_synced_commit":"a37f086a52f4416152c00614e9fc3f3f78dba1e1"},"previous_names":["arturdev/unrealm"],"tags_count":26,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matghazaryan%2FUnrealm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matghazaryan%2FUnrealm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matghazaryan%2FUnrealm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matghazaryan%2FUnrealm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/matghazaryan","download_url":"https://codeload.github.com/matghazaryan/Unrealm/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228584010,"owners_count":17940862,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["database","db","enum","ios","realm","realmswift","struct","swift","xcode"],"created_at":"2024-01-05T20:15:37.130Z","updated_at":"2024-12-09T14:30:47.689Z","avatar_url":"https://github.com/matghazaryan.png","language":"Swift","funding_links":[],"categories":["Database","Libs","Data and Storage","Data Management [🔝](#readme)","Recently Updated"],"sub_categories":["Getting Started","Data Management","Linter","[Feb 04, 2025](/content/2025/02/04/README.md)"],"readme":"\n\u003cp align=\"center\"\u003e\n\u003cimg width=\"750\" src=\"https://raw.githubusercontent.com/arturdev/Unrealm/assets/unrealm.png\" alt=\"Unrealm Header Logo\"\u003e\n\u003c/p\u003e\n\u003cbr\u003e\u003cbr\u003e\n\n\u003cp align=\"center\"\u003e\n\u003ca href=\"https://developer.apple.com/swift/\"\u003e\n\u003cimg src=\"https://img.shields.io/badge/Swift-5.1-orange.svg?style=flat\" alt=\"Swift 5.1\"\u003e\n\u003c/a\u003e\n\u003ca href=\"https://travis-ci.com/arturdev/Unrealm\"\u003e\n\u003cimg src=\"https://travis-ci.com/arturdev/Unrealm.svg?branch=master\" alt=\"Build Status\"\u003e\n\u003c/a\u003e\n\u003ca href=\"https://cocoapods.org/pods/Unrealm\"\u003e\n\u003cimg src=\"https://img.shields.io/cocoapods/v/Unrealm.svg?style=flat\" alt=\"Version\"\u003e\n\u003c/a\u003e\n\u003cimg src=\"https://img.shields.io/badge/spm-v0.2.5-orange.svg?style=flat\" alt=\"Platform\"\u003e\n\u003ca href=\"https://cocoapods.org/pods/Unrealm\"\u003e\n\u003cimg src=\"https://img.shields.io/cocoapods/l/Unrealm.svg?style=flat\" alt=\"License\"\u003e\n\u003c/a\u003e\n\u003ca href=\"https://cocoapods.org/pods/Unrealm\"\u003e\n\u003cimg src=\"https://img.shields.io/cocoapods/p/Unrealm.svg?style=flat\" alt=\"Platform\"\u003e\n\u003c/a\u003e\n\u003ca href=\"https://github.com/realm/realm-cocoa/releases/tag/v10.15.1\"\u003e\n\u003cimg src=\"https://img.shields.io/badge/RealmCocoa-v10.15.1-green?style=flat\" alt=\"Platform\"\u003e\n\u003c/a\u003e \n\u003c/p\u003e\n\n\u003cbr/\u003e\n\n\u003cp align=\"center\"\u003e\nUnrealm enables you to easily store Swift native \u003cb\u003eClasses\u003c/b\u003e, \u003cb\u003eStructs\u003c/b\u003e and \u003cb\u003eEnums\u003c/b\u003e into \u003ca href=\"https://github.com/realm/realm-cocoa\"\u003eRealm \u003cimg width=\"18\" src = \"https://raw.githubusercontent.com/arturdev/Unrealm/assets/realmLogoSmall.png\"\u003e\u003c/a\u003e.\u003cbr/\u003eStop inheriting from \u003cb\u003eObject\u003c/b\u003e! Go for Protocol-Oriented programming!\u003cbr\u003e\nMade with ❤️ by \u003ca href=\"https://github.com/matghazaryan\"\u003ematghazaryan\u003c/a\u003e\n\u003c/p\u003e\n\u003cbr\u003e\n\n\u003cp align=\"center\"\u003e\n\u003cimg width=\"1024\" src=\"https://raw.githubusercontent.com/arturdev/Unrealm/assets/preview.png\"\u003e\n\u003c/p\u003e\n\u003cbr\u003e\n\n## Features\nUnrealm supports the following types:\n\n- [x] Swift Primitives\n- [x] Swift Structs\n- [x] Swift Classes\n- [x] Swift Enums\n- [x] Swift Arrays\n- [x] Swift Dictionaries\n- [x] Nested Classes/Structs\n- [x] Swift Optionals (String, Data, Date)\n- [x] Swift Optionals of primitives (Int, Float, Double, Bool)\n- [x] Swift Optionals of Realmables\n- [x] Swift Optionals of Arrays\n- [x] Swift Arrays of enums\n\n\n## Example Project\nTo run the example project, clone the repo, and run `pod install` from the Example directory first.\u003cbr\u003e\nSee also \u003ca href=\"https://github.com/arturdev/Unrealm/blob/master/Example/Tests/Tests.swift\"\u003eUnit Tests\u003c/a\u003e.\n\n## Usage\nAll you have to do is \n1. Conform your Classes/Structs to `Realmable` protocol instead of inheriting from `Object`. Conform your Enums to `RealmableEnum` protocol.\n2. Register your Classes/Structs and Enums in AppDelegate's `didFinishLaunchingWithOptions`.\n```Swift\nRealm.registerRealmables(ToDoItem.self)\n```\nThat's it! Now you can store your Struct or Class object into Realm as usually you do with Objc Classes.\n\n## Pros and Cons \n\n#### Pros 🎉\n- Enables you to store Swift native types (Structs, Classes, Enums, Arrays, Dictionaries, etc...)\n- Getting rid of redundant inheriting from Object class\n- Getting rid of Realm crashes like \"Object has been deleted or invalidated\"\n- Getting rid of Realm crashes like \"Realm accessed from incorrect thread\"\n- Getting rid of boilerplate code such as `@objc dynamic var`. Use just `var` or `let`\n- Getting rid of boilerplate code such as `RealmOptional\u003cInt\u003e`. Use just `Int?`\n- Works perfect with Swift's Codable and optional types!\n\n#### Cons 🍟\n- 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.\nf.e.;\n```Swift\nlet realm = try! Realm()\nvar todoItem = realm.object(ofType: ToDoItem.self, forPrimaryKey: \"1\")\ntodoItem.text = \"Modified text\"\ntry! realm.write {\nrealm.add(todoItem, update: true) //\u003c- force Realm to update the object\n}\n```\n\n## Installation\n\n### CocoaPods\nUnrealm is available through [CocoaPods](https://cocoapods.org). To install\nit, simply add the following line to your Podfile:\n\n```ruby\npod 'Unrealm'\n```\n\n### Swift Package Manager\nYou can also use Swift Package Manager to add Unrealm as a dependency to your project. In order to do so, use the following URL:\n\n```bash\nhttps://github.com/matghazaryan/Unrealm.git\n```\nYou need to use \"master\" branch instead of SPM.\n## ToDos\n\n- Add more UnitTests\n- Create a sample project for Swift Package Manager when dependencies can be added to many targets in a simple project.\n\n## Contribution\n\n⭐️ If you like what you see, star us on GitHub.\n\nFind 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!\n\nContributions are welcome, and they are greatly appreciated!\n\n\n## Author\n\nmatghazaryan, matevos14@gmail.com\n\n## License\n\nUnrealm is available under the MIT license. See the LICENSE file for more info.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatghazaryan%2FUnrealm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmatghazaryan%2FUnrealm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatghazaryan%2FUnrealm/lists"}