UICollectionView+RxReusableKit.swift 604 B

12345678910111213141516171819202122232425
  1. #if !COCOAPODS
  2. import ReusableKit
  3. #endif
  4. import RxCocoa
  5. import RxSwift
  6. #if os(iOS)
  7. import UIKit
  8. extension Reactive where Base: UICollectionView {
  9. public func items<S: Sequence, Cell: UICollectionViewCell, O: ObservableType>(
  10. _ reusableCell: ReusableCell<Cell>
  11. ) -> (_ source: O)
  12. -> (_ configureCell: @escaping (Int, S.Iterator.Element, Cell) -> Void)
  13. -> Disposable
  14. where O.Element == S {
  15. return { source in
  16. return { configureCell in
  17. return self.items(cellIdentifier: reusableCell.identifier, cellType: Cell.self)(source)(configureCell)
  18. }
  19. }
  20. }
  21. }
  22. #endif