{"action":"created","issue":{"url":"https://api.github.com/repos/realm/realm-cocoa/issues/1999","labels_url":"https://api.github.com/repos/realm/realm-cocoa/issues/1999/labels{/name}","comments_url":"https://api.github.com/repos/realm/realm-cocoa/issues/1999/comments","events_url":"https://api.github.com/repos/realm/realm-cocoa/issues/1999/events","html_url":"https://github.com/realm/realm-cocoa/issues/1999","id":80711301,"number":1999,"title":"RealmSwift reset relationship list","user":{"login":"krzyzanowskim","id":758033,"avatar_url":"https://avatars.githubusercontent.com/u/758033?v=3","gravatar_id":"","url":"https://api.github.com/users/krzyzanowskim","html_url":"https://github.com/krzyzanowskim","followers_url":"https://api.github.com/users/krzyzanowskim/followers","following_url":"https://api.github.com/users/krzyzanowskim/following{/other_user}","gists_url":"https://api.github.com/users/krzyzanowskim/gists{/gist_id}","starred_url":"https://api.github.com/users/krzyzanowskim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/krzyzanowskim/subscriptions","organizations_url":"https://api.github.com/users/krzyzanowskim/orgs","repos_url":"https://api.github.com/users/krzyzanowskim/repos","events_url":"https://api.github.com/users/krzyzanowskim/events{/privacy}","received_events_url":"https://api.github.com/users/krzyzanowskim/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/realm/realm-cocoa/labels/Help","name":"Help","color":"cc317c"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":14,"created_at":"2015-05-25T23:52:58Z","updated_at":"2015-10-20T22:25:49Z","closed_at":"2015-05-26T17:36:25Z","body":"Hi.\r\n\r\nI have a relationship that I want to reset with new list, and I can't make is happen. What is the proper way to reset relationship ?\r\n\r\n\r\nthis is what I tried\r\n```swift\r\nclass MyModel: Object {\r\n    var childs =  List<Child>()\r\n\r\n    func change() {\r\n       realm?.write {\r\n            // I want to replace childs relationship list. Nothing I tries is working\r\n            // self.realm?.delete(self.childs)\r\n            // self.chats.removeAll()\r\n            self.childs = List<Child>()\r\n            self.childs.extend(newChildrens)\r\n       }\r\n    }\r\n}\r\n\r\n```"},"comment":{"url":"https://api.github.com/repos/realm/realm-cocoa/issues/comments/149720483","html_url":"https://github.com/realm/realm-cocoa/issues/1999#issuecomment-149720483","issue_url":"https://api.github.com/repos/realm/realm-cocoa/issues/1999","id":149720483,"user":{"login":"AndrewBarba","id":1316152,"avatar_url":"https://avatars.githubusercontent.com/u/1316152?v=3","gravatar_id":"","url":"https://api.github.com/users/AndrewBarba","html_url":"https://github.com/AndrewBarba","followers_url":"https://api.github.com/users/AndrewBarba/followers","following_url":"https://api.github.com/users/AndrewBarba/following{/other_user}","gists_url":"https://api.github.com/users/AndrewBarba/gists{/gist_id}","starred_url":"https://api.github.com/users/AndrewBarba/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AndrewBarba/subscriptions","organizations_url":"https://api.github.com/users/AndrewBarba/orgs","repos_url":"https://api.github.com/users/AndrewBarba/repos","events_url":"https://api.github.com/users/AndrewBarba/events{/privacy}","received_events_url":"https://api.github.com/users/AndrewBarba/received_events","type":"User","site_admin":false},"created_at":"2015-10-20T22:25:49Z","updated_at":"2015-10-20T22:25:49Z","body":"Okay I figured it out... ObjectMapper will set the property to itself. So instead I made an extension:\r\n```\r\n// MARK: - List\r\n\r\nextension List {\r\n    \r\n    public func replace(list: List, delete: Bool = false) {\r\n        if list === self { return }\r\n        removeAll()\r\n        appendContentsOf(list)\r\n    }\r\n}\r\n```\r\nAnd then I can just use:\r\n```\r\npublic var images: List<Image> = List() {\r\n    willSet { images.replace(newValue) }\r\n}\r\n```"}}