Refactor and fix annotations

This commit is contained in:
Pavel Lukandiy 2018-05-21 21:09:56 +03:00
parent a6ce1288ba
commit 6982b95659
3 changed files with 8 additions and 8 deletions

View File

@ -177,15 +177,14 @@ final public class PaginationWrapper<Cursor: ResettableRxDataSourceCursor, Deleg
wrappedView.scrollView.support.refreshControl?.endRefreshing()
}
let customErrorHandling = uiDelegate?.customInitialLoadingErrorHandling(for: error) ?? false
delegate?.clearData()
let customErrorHandling = uiDelegate?.customInitialLoadingErrorHandling(for: error) ?? false
guard !customErrorHandling, let errorView = uiDelegate?.errorPlaceholder(for: error) else {
return
}
replacePlaceholderViewIfNeeded(with: errorView)
delegate?.clearView()
} else if case .loadingMore = afterState {
removeInfiniteScroll()
@ -213,7 +212,7 @@ final public class PaginationWrapper<Cursor: ResettableRxDataSourceCursor, Deleg
wrappedView.scrollView.support.refreshControl?.endRefreshing()
}
delegate?.clearView()
delegate?.clearData()
guard let emptyView = uiDelegate?.emptyPlaceholder() else {
return

View File

@ -20,8 +20,7 @@
// THE SOFTWARE.
//
/// PaginationWrapper delegate used for pagination results handling and
/// customization of bound states (loading, empty, error, etc.).
/// PaginationWrapper delegate used for pagination results handling
public protocol PaginationWrapperDelegate: class {
associatedtype DataSourceType: DataSource
@ -42,6 +41,6 @@ public protocol PaginationWrapperDelegate: class {
func paginationWrapper(didReload allItems: DataSourceType.ResultType,
using dataSource: DataSourceType)
/// Clears view when placeholder is shown.
func clearView()
/// Handles empty data state.
func clearData()
}

View File

@ -20,6 +20,8 @@
// THE SOFTWARE.
//
/// PaginationWrapper UI delegate used for customization
/// of bound states (loading, empty, error, etc.).
public protocol PaginationWrapperUIDelegate: class {
/// Returns placeholder view for empty state.