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 {
20
20
class BaseListViewController2 < PageType: CustomStringConvertible > : UIViewController ,
21
21
ListSwiftAdapterDataSource ,
22
22
FeedDelegate ,
23
- LoadMoreSectionController2Delegate {
23
+ LoadMoreSectionController2Delegate ,
24
+ ListSwiftAdapterEmptyViewSource ,
25
+ EmptyViewDelegate {
24
26
25
27
private let emptyErrorMessage : String
26
28
@@ -44,6 +46,7 @@ LoadMoreSectionController2Delegate {
44
46
super. viewDidLoad ( )
45
47
feed. viewDidLoad ( )
46
48
feed. swiftAdapter. dataSource = self
49
+ feed. swiftAdapter. emptyViewSource = self
47
50
}
48
51
49
52
override func viewWillAppear( _ animated: Bool ) {
@@ -146,5 +149,22 @@ LoadMoreSectionController2Delegate {
146
149
func didSelect( controller: LoadMoreSectionController2 ) {
147
150
fetch ( page: page)
148
151
}
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
+ }
149
169
150
170
}
You can’t perform that action at this time.
0 commit comments