This repository was archived by the owner on Sep 20, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +21
-1
lines changed
Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -20,7 +20,9 @@ protocol BaseListViewController2EmptyDataSource: class {
2020class BaseListViewController2 < PageType: CustomStringConvertible > : UIViewController ,
2121ListSwiftAdapterDataSource ,
2222FeedDelegate ,
23- LoadMoreSectionController2Delegate {
23+ LoadMoreSectionController2Delegate ,
24+ ListSwiftAdapterEmptyViewSource ,
25+ EmptyViewDelegate {
2426
2527 private let emptyErrorMessage : String
2628
@@ -44,6 +46,7 @@ LoadMoreSectionController2Delegate {
4446 super. viewDidLoad ( )
4547 feed. viewDidLoad ( )
4648 feed. swiftAdapter. dataSource = self
49+ feed. swiftAdapter. emptyViewSource = self
4750 }
4851
4952 override func viewWillAppear( _ animated: Bool ) {
@@ -146,5 +149,22 @@ LoadMoreSectionController2Delegate {
146149 func didSelect( controller: LoadMoreSectionController2 ) {
147150 fetch ( page: page)
148151 }
152+
153+ // MARK: ListSwiftAdapterEmptyViewSource
154+
155+ func emptyView( adapter: ListSwiftAdapter ) -> UIView ? {
156+ guard hasError else { return nil }
157+ let empty = EmptyView ( )
158+ empty. label. text = emptyErrorMessage
159+ empty. delegate = self
160+ empty. button. isHidden = false
161+ return empty
162+ }
163+
164+ // MARK: EmptyViewDelegate
165+
166+ func didTapRetry( ) {
167+ self . feed. refreshHead ( )
168+ }
149169
150170}
You can’t perform that action at this time.
0 commit comments