3lvis / DATASource

Core Data's NSFetchedResultsController wrapper for UITableView and UICollectionView
Other
106 stars 27 forks source link

Support of transient property for sectionName #69

Closed zarv1k closed 7 years ago

zarv1k commented 8 years ago

Transient property for sectionName does not supported for now. When I use 'firstLetter' (transient property) as sectionName in DATASource initializer I got error: 'Invalid keypath firstLetter passed to setPropertiesToFetch:' There is an issue in default implementation of UIDataSourceTableView.sectionIndexTitlesForTableView:. I suppose this method should detect is property transient and should not execute request when property is transient. Or maybe this metnod should notify developer somehow that when using transient property he must implement DATASourceDelegate.sectionIndexTitlesForDataSource: in this case.

3lvis commented 8 years ago

Hi @zarv1k,

Is this even possible with vanilla NSFetchedResultsController? I can't remember been able to make this work before. Would you mind sharing a sample code to try it out and make sure it also works here?

zarv1k commented 8 years ago

@3lvis ok, when I have time (probably at evening today) I'll try to modify your TableSwift example for using 'firstLetterOfName' as transient property instead of managed.

3lvis commented 8 years ago

Thanks a lot!

Sorix commented 8 years ago

Transient property sorting is very important by my mind, for example if you want to group items by month without storing month in database (only NSDate usually stored).

If Core Data has issues with «COUNT» maybe it will be better to specify var in DATASource configuration (e.g.: var supportTransient: Bool) where we can enable transient support by specifying that after DATASource initialization?

NSFetchedResultsController supports sectioning by transient properties out of the box without any magic, it is very strange if DATASource won’t have support of that.

3lvis commented 8 years ago

@Sorix that could be an option.

rottajuliano commented 8 years ago

I agree with Sorix, I really needed to sort in daily sections, got stuck while trying to make DATASource support it and now will switch back to NSFetchedResultsController for a while :/

henkvanderspek commented 8 years ago

The funny thing is, it worked in v. 6.0.0 for sure and it crashes in v. 6.1.1

henkvanderspek commented 8 years ago

Cool! Thanks

3lvis commented 7 years ago

Doing some spring cleaning, please make a new issue if you still want to do this.