Open Tj3n opened 8 years ago
Good idea @Tj3n we'll add it.
on the same topic, looks like we cant use update: true
in teh insert action... you guys found any way?
The only solution is to remove and then add teh field. Does it mean that realm will interpret it as modification? or like two different actions?
if it was the latter it will never show up in modifications
section in the code below:
case .Update(let objects, let deletions, let insertions, let modifications): let deletions = deletions.map { $0 } let insertions = insertions.map { (index: $0, element: objects[$0]) } let modifications = modifications.map { (index: $0, element: objects[$0]) } return ObservableChange.Update(deletions: deletions, insertions: insertions, modifications: modifications) }
I end up change the whole insert
function with the update: Bool
added, so that it will use that parameter for the Realm one inside, cant find extension solution for that since the function is based on extension and protocol already
@Tj3n which branch are you using? Cant really find this mantioned change anywhere
@thepelican it haven't been implemented yet in the lib, i changed it for my own use only, this depends on the author, he might create another function for that
@Tj3n feel free to propose your solution. I'm more than open to discuss it and merge it into the repository. I haven't started working on it yet 😛
This is actually a critical for Realm user but it's pretty easy to fix, since CoreData's NSManagedObjectContext: Context
doesnt seems to do anything with the insert
function, i just change it to func insert<T: Entity>(entity: T, update: Bool) throws
and use the update
param to pass to the Realm's add
function inside it
this issue its been closed but its not being resolved
Hi, I'd like to ask what's the correct way to update a Realm Object that doesn't have primary key in 1 closure? I tried remove + insert but it gave me error, i have to change the
insert
function toupdate: false
only it works, maybe should include another function for insert without primary key?