Hello ,
I am doing manual Diff btw two object list , and as result i get an indexeSet of inserts updated and deleted item which contains different ranges , i want to as is there any way to get real objects as well instead of just index or ranges ?
Thanks
Fazeel
README and documentationIGListKit version:Hey @fazilakhter! Good question.
Since you should have both the old and new array, you should be able to get the objects using the changeset + those arrays!
let o = [some, old, stuff]
let n = [new, hotness]
let result = IGListDiff(o, n, .equality)
for delete in result.deletes {
print("deleted \(o[delete]) at old index \(delete)")
}
for update in result.updates {
print("updated \(o[update]) at old index \(update)")
}
for insert in result.inserts {
print("inserted \(n[insert]) at new index \(insert)")
}
for move in result.moves {
print("moved \(o[move.from]) from old index \(move.from) to \(move.to)")
}
You can also use these methods to lookup the old/new index of an object using its diffIdentifier.
If this answers your question feel free to close 鈽猴笍
Nice.
You can also use these methods to lookup the old/new index of an object using its diffIdentifier.
@rnystrom @FazeelAkhtar After I read annotation of - (NSInteger)newIndexForIdentifier:(id<NSObject>)identifier; this method. I'm confused, to my understanding, this method is returned the index of the corresponding identifier of the compared new array. Am I right? I have write a demo, it is my expected result. However, the annotation still make me confused.