Creating 3D CarouselView with the help of CALayer and CATransformLayer
Drag and drop '3DCarouselView' folder in your app folder. Open your view controller where you want to add Carousel and paste following. Note that we have to suuply an array of UIImage.
var threeDCarouselView: ThreeDCarouselView! = nil
//MARK:- View Controller life cycle
override func viewDidLoad() {
super.viewDidLoad()
self.view.backgroundColor = .darkGray
//1. Add CarouselView
self.addCarousel()
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
}
//MARK:- Add CarouselView
fileprivate func addCarousel() {
self.threeDCarouselView = ThreeDCarouselView(controller: self, images: (1...6).map{UIImage(named: "m\($0)")!})
self.threeDCarouselView.applyThreeDCarousel()
}