Cuberto's development lab:
Cuberto is a leading digital agency with solid design and development expertise. We build mobile and web products for startups. Drop us a line.
SmoothScroll
Example
To run the example project, clone the repo and run AnimatedCollection.xcodeproj
Requirements
- iOS 11.0+
- Xcode 10.0
Installation
Add SmoothScroll folder to your project
Usage
-
Create a new UICollectionView in your storyboard or nib (or instantiate it from code).
-
Set layout to
Custom
and set its class to CBSmoothScrollLayout -
Register supplemetary views for Header, Menu and Title of kinds
CBSmoothScrollLayout.kCBAnimatedLayoutHeader
CBSmoothScrollLayout.kCBAnimatedLayoutMenu
CBSmoothScrollLayout.kCBAnimatedLayoutTitle
respectively
-
Check your collection view delegate to return right views from method
collectionView(_ collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, at indexPath: IndexPath)
-
Check your collection view delegate to conform
UICollectionViewSmoothScrollLayoutDelegate
protocol to provide correct size of title and handle animation progress -
Customize cells and supplementary views for your own purposes. You are free to inherit from base classes provided by us, or create your own from scratch
You can use provided CBViewAnimator
to propagate animation state to all views that conforms to CBAnimatable protocol. Just register views to animator and call updateAnimation(toProgress progress: CGFloat)
from delegate.
All parts of layout can be tuned by changing params of CBSmoothScrollLayout
Author
Cuberto Design, [email protected]
License
SmoothScroll is available under the MIT license. See the LICENSE file for more info.