Comments (5)
It is happening in both cases here is the other piece of code:
lazy var dataSource: DATASource = {
let request: NSFetchRequest = NSFetchRequest(entityName: "Report")
request.sortDescriptors = [NSSortDescriptor(key: "modifyDate", ascending: false)]
let dataSource = DATASource(tableView: self.tableView, cellIdentifier: ReportTableViewCell.Identifier, fetchRequest: request, mainContext: self.dataStack.mainContext, sectionName: "equipment.equipmentType.company.companyName", configuration: { cell, item, indexPath in
if let cell = cell as? ReportTableViewCell {
let report = item as! Report
if let imagePath = report.equipment!.path {
cell.thumbnail.image = PicManager.instance.getThumbnail(imagePath, type: K.file.equipmentThumbnails)
}
if let name = item.valueForKey("name") as? String {
cell.name.text = name
}
if let desc = item.valueForKey("reportDescription") as? String {
cell.descriptionLabel.text = desc
}
if let cwaId = item.valueForKey("cwaId") as? String {
cell.cwaId.text = "CWA# " + cwaId
}
if let final = item.valueForKey("final") as? Bool {
}
if let modifyDate = item.valueForKey("modifyDate") as? NSDate {
cell.modifiedDate.text = "Modified " + NSDate.stringForInspectionCell(modifyDate)
}
if let equipment = report.equipment {
if let equipmentName = equipment.name {
cell.equipment.text = equipmentName
if let equipmentType = equipment.equipmentType {
if let equipmentTypeName = equipmentType.name {
if equipmentTypeName != "" {
cell.equipment.text = equipmentTypeName + " - " + equipmentName
} else {
cell.equipment.text = equipmentName
}
}
}
}
}
}
})
dataSource.delegate = self
return dataSource
}()
from datasource.
Here is a data source on which you can test it.
http://haste.fit.cvut.cz/dokodig.json
from datasource.
So I found out this might be my mistake having different sortDescriptor
and sectionName
.
I changed it to same one and it works but it should work with different ones because they aways point correctly to to the same object.
Anyway I rewritten it to NsFetchResultController and it behaves identical. So it is not your mistake.
If you could comment on this and give me insight why is this behaving as it is it would be great.
from datasource.
Hi @syky27, I have been in vacation mode. Will try to reply later this week. Sorry for not being so responsive.
from datasource.
@syky27 Hi Tomas, this seems as you mentioned a NSFetchedResultsController issue, where you have to add the sortDescriptor if you are using sectioned table views, I remember getting an error from UIKit before about this but looks like they removed this error.
For example if you are grouping by firstName
you have to add firstName
as the first sortDescriptor. I'll add this to the README.
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.