Skip to content
This repository was archived by the owner on Sep 20, 2023. It is now read-only.

Commit 14d17df

Browse files
authored
Spinner on generic load more (#1414)
* spinner on generic load more * More bubble hidden on reuse
1 parent 898bddb commit 14d17df

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

Classes/Section Controllers/LoadMore/LoadMoreSectionController.swift

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ protocol LoadMoreSectionControllerDelegate: class {
1515
final class LoadMoreSectionController: ListSectionController {
1616

1717
private weak var delegate: LoadMoreSectionControllerDelegate?
18+
private var loadingOverride = false
1819

1920
init(delegate: LoadMoreSectionControllerDelegate) {
2021
self.delegate = delegate
@@ -26,15 +27,19 @@ final class LoadMoreSectionController: ListSectionController {
2627
}
2728

2829
override func cellForItem(at index: Int) -> UICollectionViewCell {
29-
guard let cell = collectionContext?.dequeueReusableCell(of: LoadMoreCell.self, for: self, at: index) else {
30+
guard let cell = collectionContext?.dequeueReusableCell(of: IssueNeckLoadCell.self, for: self, at: index) as? IssueNeckLoadCell else {
3031
fatalError("Missing context, or cell is wrong type")
3132
}
32-
33+
cell.configure(loading: loadingOverride)
3334
return cell
3435
}
3536

3637
override func didSelectItem(at index: Int) {
3738
delegate?.didSelect(sectionController: self)
39+
collectionContext?.performBatch(animated: trueUnlessReduceMotionEnabled, updates: { context in
40+
self.loadingOverride = true
41+
context.reload(self)
42+
})
3843
}
3944

4045
}

0 commit comments

Comments
 (0)