Merging models when syncing from Apple's server

This commit is contained in:
Guilherme Rambo
2017-05-07 17:58:24 -03:00
parent ede72ef17c
commit 9901d14dc8
4 changed files with 108 additions and 11 deletions

View File

@@ -64,4 +64,12 @@ public class SessionAsset: Object {
return "remoteURL"
}
func merge(with other: SessionAsset, in realm: Realm) {
assert(other.remoteURL == self.remoteURL, "Can't merge two objects with different identifiers!")
self.year = other.year
self.sessionId = other.sessionId
self.relativeLocalURL = other.relativeLocalURL
}
}