I need infinite autoscrolling effect in .linear type in iCarousel and i already achieve autoscrolling in .cylinder type but i can't achieve this effect in .linear type.
Here is my code of achieve autoscrolling in .cylinder type
carousel.type = .linear
carousel.autoscroll = -0.4;
carousel.reloadData()
Thanks @salman for an answer with the help of Salman's answer I got a solution for an infinite solution without jerking issue when carousel type is linear
Please follow the steps given below.
1. Define timer for handle scrolling
_ = Timer.scheduledTimer(timeInterval: 4, target: self, selector: #selector(self.handleTimer), userInfo: nil, repeats: true)
2. Write the delegate method of the carousel and handle wrap type with the help of wrap we solve jerk issue.
3. Method to handle scrolling
Yes, this does not work
carousel.type = .linear
in the case oflinear
so you have to make an own timer for scrolling just like that:The
index
is used to get the current data for the carousel data source.