{"id":21089755,"url":"https://github.com/hituziando/activerealm","last_synced_at":"2026-01-27T04:04:47.792Z","repository":{"id":56901507,"uuid":"189843142","full_name":"HituziANDO/ActiveRealm","owner":"HituziANDO","description":"ActiveRealm is Active Record library using Realm for Objective-C/Swift, inspired by ActiveRecord of Ruby on Rails.","archived":false,"fork":false,"pushed_at":"2024-04-30T09:46:09.000Z","size":336,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-11-11T12:16:00.963Z","etag":null,"topics":["activerecord","ios","library","model","objective-c","realm","swift"],"latest_commit_sha":null,"homepage":"","language":"Objective-C","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/HituziANDO.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-02T12:22:37.000Z","updated_at":"2024-04-30T09:44:00.000Z","dependencies_parsed_at":"2024-11-19T21:41:26.258Z","dependency_job_id":null,"html_url":"https://github.com/HituziANDO/ActiveRealm","commit_stats":{"total_commits":39,"total_committers":1,"mean_commits":39.0,"dds":0.0,"last_synced_commit":"8774df958a692e2fdbcdee1b5be54c5d69973794"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/HituziANDO/ActiveRealm","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HituziANDO%2FActiveRealm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HituziANDO%2FActiveRealm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HituziANDO%2FActiveRealm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HituziANDO%2FActiveRealm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/HituziANDO","download_url":"https://codeload.github.com/HituziANDO/ActiveRealm/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HituziANDO%2FActiveRealm/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28800962,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-27T03:44:14.111Z","status":"ssl_error","status_checked_at":"2026-01-27T03:43:33.507Z","response_time":168,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["activerecord","ios","library","model","objective-c","realm","swift"],"created_at":"2024-11-19T21:31:06.050Z","updated_at":"2026-01-27T04:04:47.749Z","avatar_url":"https://github.com/HituziANDO.png","language":"Objective-C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ActiveRealm\n\n***ActiveRealm is Active Record library using Realm for Objective-C/Swift, inspired by ActiveRecord of Ruby on Rails.***\n\n[日本語doc](https://qiita.com/hituziando/items/06f85328c500da76afc6)\n\n## Features\n\n- Made in Objective-C and supports Swift\n- Connects to Realm DB\n- Many READ operations\n- Cascade Delete by One-to-One or One-to-Many relationships\n- An ActiveRealm object can be used on multi-threads\n\n## Installation\n\n### CocoaPods\n\nActiveRealm is available through [CocoaPods](http://cocoapods.org). To install\nit, simply add the following line to your Podfile:\n\n```ruby\npod \"ActiveRealm\"\n```\n\n### Manual Installation\n\n1. Install [Realm](https://realm.io/docs/objc/latest/)\n1. Download latest [ActiveRealm](https://github.com/HituziANDO/ActiveRealm/releases)\n1. Drag \u0026 Drop ActiveRealm.framework into your Xcode project\n\n## Getting Started\n\n1. Import\n\t\n\t```swift\n\timport ActiveRealm\n\t```\n\t\n1. Setup Realm\n\t\n\tFirst, you configure your Realm configuration as default Realm. For detail, see [this](https://realm.io/docs/objc/latest/#configuring-a-realm).\n\t\n\t```swift\n\t// Configure your Realm configuration as default Realm.\n\tlet configuration = RLMRealmConfiguration.default()\n\t// Something to do\n\tRLMRealmConfiguration.setDefault(configuration)\n\t```\n\t\n1. Implement Models\n\t\n\tImplement [Realm models](https://realm.io/docs/swift/latest/#models) using ARMObject class. ARMObject is the subclass of RLMObject. ARMObject has the following three properties by default: `uid`, `createdAt`, `updatedAt`. The uid property is the primary key for an ActiveRealm model. You must use ARMObject, not RLMObject.\n\t\n\tA class name inheriting ARMObject must have the prefix: `ActiveRealm`.\n\t\n\tYour subclass of ARMObject has just properties as data saved to DB.\n\t\n\t```swift\n\tclass ActiveRealmAuthor: ARMObject {\n\t    @objc dynamic var name          = \"\"\n\t    @objc dynamic var age: NSNumber = 0\n\t}\n\t```\n\t\n\tNext, you implement models of ARMActiveRealm's subclass. A class name inheriting ARMActiveRealm must be the same as the string excluding the `ActiveRealm` prefix of the class name inheriting ARMObject.\n\t\n\te.g.) ActiveRealmAuthor -\u003e Author\n\t\n\t```swift\n\tclass Author: ARMActiveRealm {\n\t    @objc var name          = \"\"\n\t    @objc var age: NSNumber = 0\n\t}\n\t```\n\t\n\t**[IMPORTANT]** \n\t\n\t```\n\tNow, ActiveRealm does NOT support primitive type properties.\n\te.g.) Int, Float, Double, Bool, etc...\n\tPlease use NSNumber instead.\n\t```\n\t\n### Relationships\n\nYou can make a relationship between two ActiveRealm subclasses by override `definedRelationships` method. By making a relationship, cascade delete is possible. Use ARMRelationship class and ARMInverseRelationship class for making the relationship.\n\n#### One-to-One\n\nFor example, an Author object has one UserSettings object.\n\nFirst, you set related child class and `.hasOne` type to ARMRelationship object in Author class.\n\n```swift\nclass ActiveRealmAuthor: ARMObject {\n    \n    @objc dynamic var name          = \"\"\n    @objc dynamic var age: NSNumber = 0\n}\n\n// Parent\nclass Author: ARMActiveRealm {\n    \n    @objc var name          = \"\"\n    @objc var age: NSNumber = 0\n    \n    override class func definedRelationships() -\u003e [String: ARMRelationship] {\n        return [\"userSettings\": ARMRelationship(with: UserSettings.self, type: .hasOne)]\n    }\n}\n```\n\nNext, you set related parent class and `.belongsTo` type to ARMInverseRelationship object in UserSettings class. Then, you implement an `authorID` property as the foreign key. The property name as the foreign key must be the parent class name with lower case prefix and ID added to the end.\n\n```swift\nclass ActiveRealmUserSettings: ARMObject {\n    \n    @objc dynamic var authorID                      = \"\"\n    @objc dynamic var notificationEnabled: NSNumber = false\n}\n\n// Child\nclass UserSettings: ARMActiveRealm {\n    \n    @objc var authorID                      = \"\"\n    @objc var notificationEnabled: NSNumber = false\n    \n    override class func definedRelationships() -\u003e [String: ARMRelationship] {\n        return [\"author\": ARMInverseRelationship(with: Author.self, type: .belongsTo)]\n    }\n}\n```\n\n#### One-to-Many\n\nFor example, an Article object has many Tag objects.\n\nFirst, you set related child class and `.hasMany` type to ARMRelationship object in Article class.\n\n```swift\nclass ActiveRealmArticle: ARMObject {\n    \n    @objc dynamic var title = \"\"\n    @objc dynamic var text  = \"\"\n}\n\nclass Article: ARMActiveRealm {\n    \n    @objc var title = \"\"\n    @objc var text  = \"\"\n    \n    override class func definedRelationships() -\u003e [String: ARMRelationship] {\n        return [\"tags\": ARMRelationship(with: Tag.self, type: .hasMany)]\n    }\n}\n```\n\nNext, you set related parent class and `.belongsTo` type to ARMInverseRelationship object in Tag class. Then, you implement an `articleID` property as the foreign key. The property name as the foreign key must be the parent class name with lower case prefix and ID added to the end.\n\n```swift\nclass ActiveRealmTag: ARMObject {\n    \n    @objc dynamic var articleID = \"\"\n    @objc dynamic var name      = \"\"\n}\n\nclass Tag: ARMActiveRealm {\n    \n    @objc var articleID = \"\"\n    @objc var name      = \"\"\n    \n    override class func definedRelationships() -\u003e [String: ARMRelationship] {\n        return [\"article\": ARMInverseRelationship(with: Article.self, type: .belongsTo)]\n    }\n}\n```\n\n#### Access related object(s)\n\nYou can access related object(s) through `relations` property. The `relations` is the dictionary, so you specify the key that is same key of the dictionary `definedRelationships` method returns.\n\n```swift\nlet alice = Author.findOrCreate([\"name\": \"Alice\", \"age\": 28])\nUserSettings.findOrCreate([\"authorID\": alice.uid, \"notificationEnabled\": true])\n\n// One-to-One\n// Use relations[key].object\nif let settings = alice.relations[\"userSettings\"]?.object as? UserSettings {\n    // Something to do.\n}\n\nlet article = Article.findOrCreate([\"title\": \"ActiveRealm User Guide\",\n                                    \"text\": \"ActiveRealm is a library for iOS.\"])\nTag.findOrCreate([\"articleID\": article.uid, \"name\": \"Programming\"])\nTag.findOrCreate([\"articleID\": article.uid, \"name\": \"iOS\"])\n\n// One-to-Many\n// Use relations[key].objects\nif let tags = article.relations[\"tags\"]?.objects as? [Tag] {\n    // Something to do.\n}\n\n// Inverse relationship\nlet tag = Tag.find([\"articleID\": article.uid])\nif let article = tag.relations[\"article\"]?.object as? Article {\n    // Something to do.\n}\n```\n\nRecommend that you implement alias of the relation property.\n\n```swift\nclass Author: ARMActiveRealm {\n    ...\n    \n    // The relation property. This property is just alias.\n    var userSettings: UserSettings? {\n        guard let userSettings = relations[\"userSettings\"]?.object as? UserSettings else { return nil }\n        return userSettings\n    }\n    \n    override class func definedRelationships() -\u003e [String: ARMRelationship] {\n        return [\"userSettings\": ARMRelationship(with: UserSettings.self, type: .hasOne)]\n    }\n    \nclass UserSettings: ARMActiveRealm {\n    ...\n    \n    // The relation property. This property is just alias.\n    var author: Author {\n        return relations[\"author\"]?.object as! Author\n    }\n    \n    override class func definedRelationships() -\u003e [String: ARMRelationship] {\n        return [\"author\": ARMInverseRelationship(with: Author.self, type: .belongsTo)]\n    }\n}\n```\n\n## CRUD\n\n### Create\n\n#### save()\n\n`save` means INSERT if the record does not exists in the DB, otherwise UPDATE it.\n\n```swift\n// Initialize an instance.\nlet alice = Author()\nalice.name = \"Alice\"\nalice.age = 28\n\n// Insert to Realm DB.\nalice.save()\n```\n\n#### findOrInitialize(_:)\n\nFind an object if exists in Realm DB. Otherwise, initialize it with specified parameters. NOT save yet.\n\n```swift\nlet author = Author.findOrInitialize([\"name\": \"Bob\", \"age\": 55])\nauthor.save()\n```\n\n#### findOrCreate(_:)\n\nFind an object if exists in Realm DB. Otherwise, initialize it with specified parameters and insert it to the DB.\n\n```swift\nlet author = Author.findOrCreate([\"name\": \"Bob\", \"age\": 55])\n```\n\n### Read\n\nActiveRealm has many READ operations.\n\n#### all()\n\nSelect all objects.\n\n```swift\nlet authors = Author.all()\n```\n\n#### first()\n\nSelect first created object.\n\n```swift\nlet tag = Tag.first()\n```\n\n#### first(limit:)\n\nSelect specified number of objects from the head.\n\n```swift\nlet tags = Tag.first(limit: 10)\n```\n\n#### last()\n\nSelect last created object.\n\n```swift\nlet tag = Tag.last()\n```\n\n#### last(limit:)\n\nSelect specified number of objects from the tail.\n\n```swift\nlet tags = Tag.last(limit: 10)\n```\n\n#### find(ID:)\n\nFind an object by specified ID.\n\n```swift\nlet author = Author.find(ID: \"XXXXXXXX-XXXX-4XXX-XXXX-XXXXXXXXXXXX\")\n```\n\n#### find(_:)\n\nFind an object by specified parameters. When multiple objects are found, select first object.\n\n```swift\nlet author = Author.find([\"name\": \"Alice\", \"age\": 28])\n```\n\n#### find(with:)\n\nFind an object by specified parameters. When multiple objects are found, select first object.\n\n```swift\nlet author = Author.find(with: NSPredicate(format: \"age \u003e %d\", 28))\n```\n\n#### findLast(_:)\n\nFind an object by specified parameters. When multiple objects are found, select last object.\n\n```swift\nlet tag = Tag.findLast([\"articleID\": \"XXXXXXXX-XXXX-4XXX-XXXX-XXXXXXXXXXXX\"])\n```\n\n#### findLast(with:)\n\nFind an object by specified parameters. When multiple objects are found, select last object.\n\n```swift\nlet tag = Tag.findLast(with: NSPredicate(format: \"articleID=%@\", \"XXXXXXXX-XXXX-4XXX-XXXX-XXXXXXXXXXXX\"))\n```\n\n### Update\n\n#### save()\n\n```swift\nlet alice = Author.find([\"name\": \"Alice\"])\nalice.age = 29\n\n// Update.\nalice.save()\n```\n\n### Delete\n\n#### destroy()\n\n`destroy` method performs cascade delete by default. In other words, related data are also deleted collectively.\n\n```swift\nalice.destroy()\n```\n\n#### destroy(_:)\n\nDeletes objects and related objects searched by specified parameters.\n\n```swift\nAuthor.destroy([\"name\": \"Alice\"])\nAuthor.destroy(with: NSPredicate(format: \"name=%@\", \"Alice\"))\n```\n\n#### destroyAll()\n\nDeletes all objects and related objects at the same time.\n\n```swift\nAuthor.destroyAll()\n```\n\nIf not cascade deleting, use following methods. Specify false to `cascade` argument.\n\n```swift\nalice.destroy(cascade: false)\nAuthor.destroy([\"name\": \"Alice\"], cascade: false)\nAuthor.destroy(with: NSPredicate(format: \"name=%@\", \"Alice\"), cascade: false)\nAuthor.destroyAll(cascade: false)\n```\n\n### Query\n\n#### all\n\nReturns all objects of the model.\n\n```swift\nlet collection = Author.query.all\n```\n\n#### where(_:)\n\nReturns objects searched by specified parameters.\n\n```swift\nlet collection = Author.query.where([\"name\": \"Alice\"])\n```\n\n#### where(predicate:)\n\nReturns objects searched by specified searching condition with a predicate.\n\n```swift\nlet collection = Author.query.where(predicate: NSPredicate(format: \"age \u003e %d\", 40))\n```\n\n### Collection\n\n#### toArray\n\nThe models in the collection. Converts to a NSArray.\n \n```swift\nlet collection = Author.query.all\nlet authors = collection.toArray\n```\n\n#### count\n\nThe number of models in the collection.\n\n```swift\nlet collection = Author.query.all\nlet count = collection.count\n```\n\n#### first\n\nThe first model in the collection.\n\n```swift\nlet collection = Author.query.all\nlet author = collection.first\n```\n\n#### first(limit:)\n\nReturns specified number of the models from the head.\n\n```swift\nlet collection = Author.query.all\nlet authors = collection.first(limit: 5)\n```\n\n#### last\n\nThe last model in the collection.\n\n```swift\nlet collection = Author.query.all\nlet author = collection.last\n```\n\n#### last(limit:)\n\nReturns specified number of the models from the tail.\n\n```swift\nlet collection = Author.query.all\nlet authors = collection.last(limit: 5)\n```\n\n#### order(_:ascending:)\n\nSorts objects in the collection by specified property.\n\n```swift\nlet collection = Author.query.all\ncollection.order(\"age\", ascending: true)\n```\n\n#### at(_:)\n\nRetrieves an object at given index.\n\n```swift\nlet collection = Author.query.all\nlet author = collection.at(1)\n```\n\n#### pluck(_:)\n\nPlucks properties of the model.\n\n```swift\nlet collection = Author.query.all\nlet names = collection.pluck([\"name\"])\n```\n\n## Count\n\nCount objects.\n\n```swift\n// The number of all objects.\nlet count = Author.count\n```\n\n```swift\n// The number of objects matched given condition.\nlet count1 = Author.query.where([\"name\": \"Alice\"]).count\nlet count2 = Author.query.where(predicate: NSPredicate(format: \"age \u003e %d\", 40)).count\n```\n\n## Ignored properties\n\nActiveRealm saves all properties in your model to the DB by default. If you don’t want to save a property, override `ignoredProperties` method.\n\n```swift\nclass Author: ARMActiveRealm {\n    \n    @objc var name          = \"\"\n    @objc var age: NSNumber = 0\n    \n    // A property ignored by ActiveRealm.\n    @objc var shortID: String {\n        return String(uid.split(separator: \"-\").first!)\n    }\n    \n    override class func ignoredProperties() -\u003e [String] {\n        return [\"shortID\"]\n    }\n}\n```\n\n## Validation\n\nActiveRealm can validate data before saving a model. By default, the validation is always successful. If you want to validate data, override `validateBeforeSaving` method. When `validateBeforeSaving` method returns false, the data isn't saved.\n\n```swift\nclass Author: ARMActiveRealm {\n    \n    @objc var name          = \"\"\n    @objc var age: NSNumber = 0\n    \n    override class func validateBeforeSaving(_ obj: Any) -\u003e Bool {\n        let author = obj as! Author\n        \n        // The name must not be empty.\n        return !author.name.isEmpty\n    }\n}\n```\n\n## Conversion methods\n\nActiveRealm can convert properties in your model to the dictionary or JSON easily.\n\n### Converting to Dictionary\n\n#### asDictionary()\n\n```swift\nclass Author: ARMActiveRealm {\n    \n    @objc var name          = \"\"\n    @objc var age: NSNumber = 0\n    \n    // A property ignored by ActiveRealm.\n    @objc var shortID: String {\n        return String(uid.split(separator: \"-\").first!)\n    }\n    \n    override class func ignoredProperties() -\u003e [String] {\n        return [\"shortID\"]\n    }\n    \n    @objc func generation(_ obj: Author) -\u003e NSNumber {\n        return NSNumber(integerLiteral: Int(age.doubleValue / 10.0) * 10)\n    }\n}\n\nlet chris = Author.findOrCreate([\"name\": \"Chris\", \"age\": 32])\n\n// Convert to a dictionary.\nlet dict = chris.asDictionary()\n// =\u003e {\n//\tage = 32;\n//\tcreatedAt = \"2019-06-07 07:45:05 +0000\";\n//\tname = Chris;\n//\tuid = \"D56F60E1-96C1-4083-A7D4-E216FF072DEA\";\n//\tupdatedAt = \"2019-06-07 07:45:05 +0000\";\n// }\n```\n\n#### asDictionary(excepted:)\n\nConverts to a dictionary using a black list of property names.\n\n```swift\nlet dict = chris.asDictionary(excepted: [\"uid\", \"createdAt\", \"updatedAt\"])\n// =\u003e {\n//\tage = 32;\n//\tname = Chris;\n// }\n```\n\n#### asDictionary(included:)\n\nConverts to a dictionary using a white list of property names. This method also includes ignored properties.\n\n```swift\nlet dict = chris.asDictionary(included: [\"name\", \"age\", \"shortID\"])\n// =\u003e {\n//\tage = 32;\n//\tname = Chris;\n//\tshortUID = D56F60E1;\n// }\n```\n\n#### asDictionary { prop, value in }\n#### asDictionary(excepted:) { prop, value in }\n#### asDictionary(included:) { prop, value in }\n\nConverts to a dictionary using a conversion logic.\n\n```swift\n// Using a conversion logic.\nlet dict = chris.asDictionary(included: [\"uid\"]) { prop, value in\n    if prop == \"uid\" {\n        let uuid = value as! String\n        return uuid.split(separator: \"-\").first!\n    }\n    return value\n}\n// =\u003e {\n//\tuid = D56F60E1;\n// }\n```\n\n#### asDictionary(addingPropertiesWith:methods:)\n#### asDictionary(excepted:addingPropertiesWith:methods:)\n#### asDictionary(included:addingPropertiesWith:methods:)\n\nConverts to a dictionary adding properties with a conversion method of a target. The method name is specified by Objective-C representation.\n\n```swift\nlet dict = chris.asDictionary(included: [\"name\"],\n                              addingPropertiesWith: chris,\n                              methods: [\"generation\": \"generation:\"])\n// =\u003e {\n//\tgeneration = 30;\n//\tname = Chris;\n// }\n```\n\n### Converting to JSON\n\n#### asJSON(), asJSONString()\n\nThe `asJSON` method returns a Data type value. On the other hand, the `asJSONString` method returns a String type value.\n\n```swift\nclass Author: ARMActiveRealm {\n    \n    @objc var name          = \"\"\n    @objc var age: NSNumber = 0\n    \n    // A property ignored by ActiveRealm.\n    @objc var shortID: String {\n        return String(uid.split(separator: \"-\").first!)\n    }\n    \n    override class func ignoredProperties() -\u003e [String] {\n        return [\"shortID\"]\n    }\n    \n    @objc func generation(_ obj: Author) -\u003e NSNumber {\n        return NSNumber(integerLiteral: Int(age.doubleValue / 10.0) * 10)\n    }\n}\n\nlet chris = Author.findOrCreate([\"name\": \"Chris\", \"age\": 32])\n\n// Convert to a JSON.\nlet json = chris.asJSONString()\n// =\u003e {\n//\t\"age\" : 32,\n//\t\"uid\" : \"66703A0B-5712-4631-83C4-DF52E1CCE15F\",\n//\t\"updatedAt\" : \"2019-06-07 09:15:15 +0000\",\n//\t\"name\" : \"Chris\",\n//\t\"createdAt\" : \"2019-06-07 09:15:15 +0000\"\n// }\n```\n\n#### asJSON(excepted:), asJSONString(excepted:)\n\nConverts to a JSON using a black list of property names.\n\n```swift\nlet json = chris.asJSONString(excepted: [\"uid\", \"createdAt\", \"updatedAt\"])\n// =\u003e {\n//\t\"age\" : 32,\n//\t\"name\" : \"Chris\"\n// }\n```\n\n#### asJSON(included:), asJSONString(included:)\n\nConverts to a JSON using a white list of property names. This method also includes ignored properties.\n\n```swift\nlet json = chris.asJSONString(included: [\"name\", \"age\", \"shortID\"])\n// =\u003e {\n//\t\"age\" : 32,\n//\t\"name\" : \"Chris\",\n//\t\"shortUID\" : \"66703A0B\"\n// }\n```\n\n#### asJSON { prop, value in }, asJSONString { prop, value in }\n#### asJSON(excepted:) { prop, value in }, asJSONString(excepted:) { prop, value in }\n#### asJSON(included:) { prop, value in }, asJSONString(included:) { prop, value in }\n\nConverts to a JSON using a conversion logic.\n\n```swift\nlet json = chris.asJSONString(included: [\"uid\"]) { prop, value in\n    if prop == \"uid\" {\n        let uuid = value as! String\n        return uuid.split(separator: \"-\").first!\n    }\n    return value\n}\n// =\u003e {\n//\t\"uid\" : \"66703A0B\"\n// }\n```\n\n#### asJSON(addingPropertiesWith:methods:), asJSONString(addingPropertiesWith:methods:)\n#### asJSON(excepted:addingPropertiesWith:methods:), asJSONString(excepted:addingPropertiesWith:methods:)\n#### asJSON(included:addingPropertiesWith:methods:), asJSONString(included:addingPropertiesWith:methods:)\n\nConverts to a JSON adding properties with a conversion method of a target. The method name is specified by Objective-C representation.\n\n```swift\nlet json = chris.asJSONString(excepted: [\"uid\", \"createdAt\", \"updatedAt\", \"age\"],\n                              addingPropertiesWith: chris,\n                              methods: [\"generation\": \"generation:\"])\n// =\u003e {\n//\t\"generation\" : 30,\n//\t\"name\" : \"Chris\"\n// }\n```\n\n## Usage in Objective-C\nUsage in Objective-C, see [my sample code](https://github.com/HituziANDO/ActiveRealm/blob/master/ActiveRealmSample/ActiveRealmSample/ViewController.m).\n\n## TODO\n\n- Supports Many-to-Many relationship\n- Supports NOT NULL constraint\n- Supports primitive types. e.g.) NSInteger, float, double, BOOL, etc...\n- Property names mapping","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhituziando%2Factiverealm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhituziando%2Factiverealm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhituziando%2Factiverealm/lists"}