Comments (10)
Hi Amanbolat,
Interesting problem. I believe the error is happening because new animations are starting while other ones are in progress. Combining multiple data sources in one table view has given me a lot of headaches in the past, I think we could figure out some workarounds if we manage to reproduce the error in a sample project, but have you considered using 3 table views each one with a different data source and just switch between them when the segmented control changes his value? Might make things much faster.
from datasource.
I will try your method with multiple table views and also will create sample project to reproduce the error.
from datasource.
@3lvis I found problem. Because i have only one tableView and multiple dataSources, each time i change dataSource for my tableView, previous dataSource doesn't stop call functions of it's NSFetchedResultsControllerDelegate functions:
controllerWillChangeContent
controllerDidChangeContent
If i'm right all these methods still use tableView and cause problem.
So i added new var isUpdatingTableView = true
and this method, that i call when user changes segment of segmentedControl:
func segmentValueChanged(segmentedControl: UISegmentedControl) {
if segmentedControl.selectedSegmentIndex == 0 {
dataSourceONE.isUpdatingTableView = true
dataSourceTWO.isUpdatingTableView = false
dataSourceTHREE.isUpdatingTableView = false
self.tableView.dataSource = dataSourceONE
self.activeFRCSource = dataSourceONE
} else if segmentedControl.selectedSegmentIndex == 1 {
dataSourceTWO.isUpdatingTableView = true
dataSourceONE.isUpdatingTableView = false
dataSourceTHREE.isUpdatingTableView = false
self.tableView.dataSource = dataSourceTWO
self.activeFRCSource = dataSourceTWO
} else if segmentedControl.selectedSegmentIndex == 2 {
dataSourceTHREE.isUpdatingTableView = true
dataSourceTWO.isUpdatingTableView = false
dataSourceONE.isUpdatingTableView = false
self.tableView.dataSource = dataSourceTHREE
self.activeFRCSource = dataSourceTHREE
}
self.tableView.reloadData()
}
I think u can add feature it to your DATASource if somebody faced same problem.
from datasource.
Hi @amanbolat,
Before I had something like what you're showing here, but it ended up introducing more problems than solutions. I'm happy that you got to fix your issue, I still think having multiple-controllers and datasources, or even just updating the predicate when switching datasources could be a better solution.
https://github.com/3lvis/DATASource/blob/master/Source/DATASource.swift#L84-L102
Let me know if I can help with anything else.
Best,
from datasource.
Something like this could help too
http://stackoverflow.com/a/28878191/717416
from datasource.
Thanks, it's good idea. I'll try it too.
from datasource.
@amanbolat Is there a chance you could share a sample project reproducing this issue? Would be nice to get it fixed in case is affecting other users too.
from datasource.
@3lvis https://github.com/amanbolat/DATASourceMultipleSourceSample
On viewDidLoad it will fetch data and save to core data, then u can delete and fetch again, until u delete go to another segment fetch again and go back to first segment.
But i don't use your DATAStack, because i'm not so good at Core Data and have my own stack.
EDIT: I added Delete button to reproduce issue, because in my app i use our company ERP API where data is edited, deleted, added every minute and user need to be synced.
from datasource.
@amanbolat thanks a lot! This is very useful.
from datasource.
Doing some spring cleaning, please make a new issue if you still want to do this.
from datasource.
Related Issues (20)
- No Example to delete items in table-view HOT 2
- Predicate update for DATASource cause crash HOT 2
- Filtering DATASource HOT 2
- Sorting by distance HOT 6
- Pagination HOT 5
- Customizing change animations in Objective C HOT 3
- How to change predicate on fetchrequest? HOT 3
- NSRangeException exception in NSFetchedResultsChangeUpdate event of NSFetchedResultsController HOT 2
- UITableVIew swipe trailingSwipeActionsConfigurationForRowAt not working HOT 4
- sortDescriptors proposal HOT 4
- NSInternalInconsistencyException at controllerDidChangeContent (DATASource+NSFetchedResultsControllerDelegate.swift:137) HOT 5
- Updating core data object causes DATASource to delete from tableView HOT 5
- Invalid Update Crash HOT 1
- Unit test viewForSupplementaryElementOfKind with title HOT 1
- Multiple cell identifier support HOT 7
- TableViewCRUDAndReorder Demo HOT 2
- Demo on multiple cell identifier
- Add a way to disable calling configure cell in cellForItemAt HOT 1
- Assertion failure in -[UITableView _endCellAnimationsWithContext HOT 10
- DidSelectRowAtIndexPath HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from datasource.