Open tamoyal opened 5 years ago
One difference between my use case and the one in the Load More example is that mine will always have a section on top whereas I noticed the Load More example only has it on pull up. So my objects for delegate method looks like this:
func objects(for listAdapter: ListAdapter) -> [ListDiffable] {
return [FavoritesViewModel()] + data
}
The top section is a quick tap to favorites. Would this cause a problem? If so, I'm actually confused as to why the emptyView(for listAdapter: ListAdapter)
ever gets called in the first place.
@tamoyal is there a way to modify our example to reproduce your issue?
mine will always have a section on top
The empty view is only visible when the data is empty. If you want to show some sort of "empty" view when there's fixed data in the view, you'll need to use another section controller for that. We do this in GitHawk if you want to see some examples.
@rnystrom Thank you for the fast response. I do often use GitHawk as a reference. Would a good example be the BookmarkViewController
? That's pretty much the strategy I'm using except that I want the header to always be there since it's a filter bar and if the data is empty, you can change filters and it won't be empty. What I see you do there is show the header when there is data.
I'm using two section controllers like below:
func listAdapter(_ listAdapter: ListAdapter, sectionControllerFor object: Any) -> ListSectionController {
if object is FavoritesViewModel {
return HeaderSectionController()
} else {
return JobSectionController()
}
}
where the JobSectionController
correlates to one job.
class JobSectionController: ListSectionController {
private var object: Job?
...
Is there another example in GitHawk you can think of that is closer to what I'm trying to do here? If not, will get an example project together and put on github!
I'm using
IGListKit
in a way similar to the Load More example. I have a separate section controller for a separate view on top and a section controller for the data below. When there is no data, I have confirmed theemptyView(for listAdapter: ListAdapter)
callback is hit but when I return a view such as aUILabel
, it is not visible. However if I remove the top section, it is visible. So issue is narrowed down. Is there anything else I need to do to get this view to show?New issue checklist
README
and documentationGeneral information
IGListKit
version: 3.4.0