Open CavalcanteLeo opened 6 years ago
Create Swift Extension and import into your objective-C class
@objc public extension AnimatedCollectionViewLayout{
@objc class func initWithPageAnimator() -> AnimatedCollectionViewLayout{
let layout = AnimatedCollectionViewLayout()
layout.scrollDirection = .horizontal
layout.animator = PageAttributesAnimator(scaleRate: 0.0)
layout.sectionInset = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
layout.minimumInteritemSpacing = 0
layout.minimumLineSpacing = 0
return layout
}
@objc class func initWithParallaxAnimator() -> AnimatedCollectionViewLayout{
let layout = AnimatedCollectionViewLayout()
layout.scrollDirection = .horizontal
layout.animator = ParallaxAttributesAnimator(speed: 0.2)
layout.sectionInset = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
layout.minimumInteritemSpacing = 0
layout.minimumLineSpacing = 0
return layout
}
}
Just use like this
self.collectionView.collectionViewLayout = (AnimatedCollectionViewLayout*)[AnimatedCollectionViewLayout initWithPageAnimator]; }
I can't use any property in objective-c (eg:
layout.animator
), none of them are visible.