Merge pull request #85 from TouchInstinct/fix/paginationWrapper

Clear tableview if placeholder is shown
This commit is contained in:
Ivan Zinovyev 2017-09-14 18:11:33 +03:00 committed by GitHub
commit 410d08ad7e
3 changed files with 10 additions and 5 deletions

5
CHANGELOG.md Normal file
View File

@ -0,0 +1,5 @@
# Changelog
## 0.5.6
- [Fix] Clear tableview if placeholder is shown

View File

@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "LeadKit"
s.version = "0.5.5"
s.version = "0.5.6"
s.summary = "iOS framework with a bunch of tools for rapid development"
s.homepage = "https://github.com/TouchInstinct/LeadKit"
s.license = "Apache License, Version 2.0"

View File

@ -91,6 +91,8 @@ public protocol PaginationTableViewWrapperDelegate: class {
/// - Returns: Preferred height of "retry load more" button.
func retryLoadMoreButtonHeight(forPaginationWrapper wrapper: PaginationTableViewWrapper<Cursor, Self>) -> CGFloat
// Delegate method, used to clear tableView if placeholder is shown.
func clearTableView()
}
/// Class that connects PaginationViewModel with UITableView. It handles all non-visual and visual states.
@ -261,10 +263,6 @@ where Delegate.Cursor == Cursor {
}
private func replacePlaceholderViewIfNeeded(with placeholderView: UIView) {
// don't update placeholder view if previous placeholder is the same one
if currentPlaceholderView === placeholderView {
return
}
tableView.isUserInteractionEnabled = true
removeCurrentPlaceholderView()
@ -345,8 +343,10 @@ where Delegate.Cursor == Cursor {
case .results(let newItems, let cursor, let after):
self?.onResultsState(newItems: newItems, inCursor: cursor, afterState: after)
case .error(let error, let after):
self?.delegate?.clearTableView()
self?.onErrorState(error: error, afterState: after)
case .empty:
self?.delegate?.clearTableView()
self?.onEmptyState()
case .exhausted:
self?.onExhaustedState()