{"action":"created","issue":{"url":"https://api.github.com/repos/realm/realm-cocoa/issues/3946","repository_url":"https://api.github.com/repos/realm/realm-cocoa","labels_url":"https://api.github.com/repos/realm/realm-cocoa/issues/3946/labels{/name}","comments_url":"https://api.github.com/repos/realm/realm-cocoa/issues/3946/comments","events_url":"https://api.github.com/repos/realm/realm-cocoa/issues/3946/events","html_url":"https://github.com/realm/realm-cocoa/pull/3946","id":169977355,"number":3946,"title":"Implement async handover","user":{"login":"JadenGeller","id":4544152,"avatar_url":"https://avatars.githubusercontent.com/u/4544152?v=3","gravatar_id":"","url":"https://api.github.com/users/JadenGeller","html_url":"https://github.com/JadenGeller","followers_url":"https://api.github.com/users/JadenGeller/followers","following_url":"https://api.github.com/users/JadenGeller/following{/other_user}","gists_url":"https://api.github.com/users/JadenGeller/gists{/gist_id}","starred_url":"https://api.github.com/users/JadenGeller/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JadenGeller/subscriptions","organizations_url":"https://api.github.com/users/JadenGeller/orgs","repos_url":"https://api.github.com/users/JadenGeller/repos","events_url":"https://api.github.com/users/JadenGeller/events{/privacy}","received_events_url":"https://api.github.com/users/JadenGeller/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/realm/realm-cocoa/labels/S:Review","name":"S:Review","color":"ededed"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-08-08T17:22:17Z","updated_at":"2016-08-19T23:55:06Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/realm/realm-cocoa/pulls/3946","html_url":"https://github.com/realm/realm-cocoa/pull/3946","diff_url":"https://github.com/realm/realm-cocoa/pull/3946.diff","patch_url":"https://github.com/realm/realm-cocoa/pull/3946.patch"},"body":"A versatile async handover API is introduced using the `Realm.exportThreadHandover(containing:)` and `ThreadHandover.importOnCurrentThread()` APIs.\r\n```swift\r\nlet handover = realm.exportThreadHandover(containing: [foo, bar])\r\nqueue.async {\r\n    let (realm, objects) = try! handover.importOnCurrentThread()\r\n    let (foo, bar) = (objects[0], objects[1])\r\n    try! realm.write {\r\n        // do stuff\r\n    }\r\n}\r\n```\r\nThe Objective-C API is nearly identical to the Swift API except that `[RLMThreadHandover importOnCurrentThread]` returns a `RLMThreadImport` instead of a tuple.\r\n\r\nThis implementation of handover has been build on top of the newly introduced Object Store support for handover https://github.com/realm/realm-object-store/pull/116 so this PR only deals with binding-specific code.\r\n\r\nUnlike https://github.com/realm/realm-cocoa/pull/3828, this implementation does not end the read transaction on handover import. Instead, it will advance the transaction version or the handover version such that they are compatible. Because of this, `ThreadHandover.importOnCurrentThread()` refreshes the Realm and no longer invalidates accessors.\r\n\r\nNote that this PR leaves out any convenience API since there was too much disagreement among the team as to how it should be structured. This API will likely be added in a future PR."},"comment":{"url":"https://api.github.com/repos/realm/realm-cocoa/issues/comments/241162587","html_url":"https://github.com/realm/realm-cocoa/pull/3946#issuecomment-241162587","issue_url":"https://api.github.com/repos/realm/realm-cocoa/issues/3946","id":241162587,"user":{"login":"JadenGeller","id":4544152,"avatar_url":"https://avatars.githubusercontent.com/u/4544152?v=3","gravatar_id":"","url":"https://api.github.com/users/JadenGeller","html_url":"https://github.com/JadenGeller","followers_url":"https://api.github.com/users/JadenGeller/followers","following_url":"https://api.github.com/users/JadenGeller/following{/other_user}","gists_url":"https://api.github.com/users/JadenGeller/gists{/gist_id}","starred_url":"https://api.github.com/users/JadenGeller/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JadenGeller/subscriptions","organizations_url":"https://api.github.com/users/JadenGeller/orgs","repos_url":"https://api.github.com/users/JadenGeller/repos","events_url":"https://api.github.com/users/JadenGeller/events{/privacy}","received_events_url":"https://api.github.com/users/JadenGeller/received_events","type":"User","site_admin":false},"created_at":"2016-08-19T23:55:06Z","updated_at":"2016-08-19T23:55:06Z","body":"@bdash This is ready for re-review whenever you're ready."}}
{"actor":{"display_login":"JadenGeller"}}