teambition/TBEmptyDataSet

How to show emptyDataSet later than reloadData()

kevinvugts opened this issue · 1 comments

I want emptyDataSet to appear when I made a network request and it did fail. (for example if there was no internet connection) Currently I am working with observer pattern. And The observer error will be triggered if there was an error. Then this observer will trigger a function and now I want to show the emptyDataSet with the correct title of the error message.

_ = presenter.groupsError.skip(first: 1).observeNext { message in self.groupsLoadingError(message: message) }

private func groupsLoadingError(message: String)
{
errorMessage = message
_ = tableView.emptyDataSetDelegate?.emptyDataSetShouldDisplay(in: tableView)
}

And at this moment in the groupsLoadingError function it should trigger the emptyDataSet.

How can I do that?

@kevinvugts I'm not really sure what your trouble is.

But in my opinion, you can do it as same as the example of TBEmptyDataSet, retain a boolean property isLoading to decide whether to display the emptyDataSet.