EPCardZoomLayout
Setup
- Instantiate EPInfiniteController of your
ModelType
private let ic = EPInfiniteController<YourModel>()
- Setup Infinite Behaviour
private func setupInfiniteScrolling() {
// `collectionView` and `layout` Will be used to
// Calculate Scroll Points
ic.setCollectionView(collectionView)
ic.scrollCoordinator.setLayout(cellSize: CUI.Item.cellSize, cellSpacing: CUI.Item.cellSpacing)
// Will be used for animation
ic.animator.setMinScale(CUI.Item.cellScale)
}
- Update InfiniteController's datasource
private func fetchModel() {
let fetched = YourModel()
ic.dataProvider.update(with: fetched)
}
- Update container's center after view ended layout
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
// To appear nicely
ic.scrollToCenter(animated: false)
// To recalculate scroll points
ic.scrollCoordinator.updateContainerCenter(collectionView.center)
}
- Coordinate scrolling and animations
func scrollViewDidScroll(_ scrollView: UIScrollView) {
let visibleCells = collectionView.visibleCells
ic.animator.transform(visibleCells)
ic.scrollCoordinator.onScroll(scrollView)
}
- You're good to go!