-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NSInternalInconsistencyException
using MVVM approach
#62
Comments
Some improvement here. After new tests, I saw that the crash occurred only when the previous value is empty. Everything is working fine with with changing the code like this: extension ViewController: InteractorDelegate {
func viewModelDidChange(_ old: ViewModel?, _ new: ViewModel) {
DispatchQueue.main.async {
guard old != nil && !old!.viewModels.isEmpty else {
self.tableView.reloadData()
return
}
self.tableView.animateRowChanges(oldData: old!.viewModels, newData: new.viewModels)
}
}
} Same success when putting back RxSwift instead of the delegate. Even if it is working as expected now. I am still questioning why the diffing isn't working when the array is empty. Having an previous value empty and a new value with 2 elements should be analyzed as 2 inserts no? |
Hi @florianldt, it is difficult to tell what exactly is going on with just the code you posted here. Could you maybe provide a self-contained sample app showcasing the issue? By the looks of the error message you are getting, I have faced a similar issue in the past. I believe this can happen if you don't use the API correctly and you schedule a transition before the When the underlying data has changed, you call Scheduling the transition when the underlying data has already changed is simply too late. So how can you work around this issue? The correct way to use these APIs is updating your data source between
Differ supports this since release 1.4.3 in the form of an additional Once that feature lands, you should be able to resolve your issue by changing the
Your implementation of
Alternatively, you can write a custom wrapper to @tonyarnold Considering the APIs appear to be widely used incorrectly, do you think we could deprecate the non- |
Hi and thank you for this library. I am new to diffing.
I tested the example project and I am now trying to use Diffing with MMVM.
Here is the simple MVVM code I am using to try it:
Here for the
Controller
part:Here is what I got:
I first posted the question on stack overflow but maybe this is where it should be asked.
Is there something wrong with
Equatable
or am I missing something?Thank you.
The text was updated successfully, but these errors were encountered: