Swift-only implementation of YRCoverFlowLayout. Also supports CocoaPods. Supports Swift 5. To use with Swift 3, select swift3 branch instead.
This custom layout provides cover flow effect for UICollectionView. This project is a port of YRCoverFlowLayout to Swift, with CocoaPods support added.
From YRCoverFlowLayout description: You don’t need to worry about items(cells) positions, spaces between them, etc. because it’s already done in YRCoverFlowLayout! You simply design your cell and return them as usual in datasource methods and YRCoverFlowLayout handles the rest.
pod 'LNICoverFlowLayout'and run
See included demo for more information.
There are 4 properties that can be customized:
Max degree of rotation for items. Default to 45. This means that item on a left side of screen will be rotated 45 degrees around y and item on a right side will be rotated -45 degrees around y. In Swift implementation, this ranges between -360 and 360.
public var maxCoverDegree:CGFloat
This property means how neighbour items are placed to in relation to currently displayed item. Default to 1/4. This means that item on left will cover 1/4 of current displayed item and item from right will also cover 1/4 of current item. Value should be in 0..1 range. In Swift implementation, the range is enforced.
public var coverDensity:CGFloat
Min opacity that can be applied to individual item. Default to 1.0 (alpha 100%). In Swift implementation, the range is enforced.
public var minCoverOpacity:CGFloat
Min scale that can be applied to individual item. Default to 1.0 (no scale).
public var minCoverScale:CGFloat
If you’re changing them at runtime - don’t forget to call
Currently only horizontal scroll direction is supported. In future releases vertical scrolling will be added too.
Cover flow, custom layout, collection view, swift