simplify search setup, add loading spinner

This commit is contained in:
Ryan Nystrom
2017-09-04 16:52:22 -04:00
parent 0f98ab27c7
commit 1d6f5858fd
9 changed files with 110 additions and 83 deletions

View File

@@ -0,0 +1,40 @@
//
// LoadMoreSectionController.swift
// Freetime
//
// Created by Sherlock, James on 28/07/2017.
// Copyright © 2017 Ryan Nystrom. All rights reserved.
//
import IGListKit
protocol LoadMoreSectionControllerDelegate: class {
func didSelect(sectionController: LoadMoreSectionController)
}
final class LoadMoreSectionController: ListSectionController {
private weak var delegate: LoadMoreSectionControllerDelegate? = nil
init(delegate: LoadMoreSectionControllerDelegate) {
self.delegate = delegate
}
override func sizeForItem(at index: Int) -> CGSize {
guard let width = collectionContext?.containerSize.width else { fatalError("Missing context") }
return CGSize(width: width, height: Styles.Sizes.tableCellHeight)
}
override func cellForItem(at index: Int) -> UICollectionViewCell {
guard let cell = collectionContext?.dequeueReusableCell(of: LoadMoreCell.self, for: self, at: index) else {
fatalError("Missing context, or cell is wrong type")
}
return cell
}
override func didSelectItem(at index: Int) {
delegate?.didSelect(sectionController: self)
}
}