A UICollectionViewLayout subclass that adds custom transitions/animations to the UICollectionView without effecting your existing code.
UICollectionViewhas no transition effects when you scroll from one item to another. There are lots of ways to write animations for UICollectionView, but using a UICollectionViewLayout subclass is by far the simplest one. And it doesn't break any of your existing code. You can still use your UICollectionView subclass and you don't need to change your UICollectionViewCell. Just plug and enjoy.
To run the example project, clone the repo, and start
iOS Examplein Xcode.
To integrate AnimatedCollectionViewLayout into your Xcode project using CocoaPods, specify it in your
For Swift 4.2 or above:
For Swift 4.1 or below:
pod 'AnimatedCollectionViewLayout', '~> 0.3.0'
Carthage and Swift Package Manager are also supported.
Import the library where you want to use it. Create a
AnimatedCollectionViewLayoutobject, set its
animatorand assign it to your
let layout = AnimatedCollectionViewLayout() layout.animator = ParallaxAttributesAnimator() collectionView.collectionViewLayout = layout
Most of the built-in animators work best in Paging mode and they have additional parameters that you can tweak for better transitions. You can also write your own animators by implementing the protocol
AnimatedCollectionViewLayout is available under the MIT license. See the LICENSE file for more info.