Is there a way to pause the images in iCarousel for iOS?

63 views Asked by At

I am currently using iCarousel for the project and I have been asked to pause every image on the front for N seconds and then keep scrolling (there is autoscroll method). I tried using double timer, tried to change the images, but no success.

1

There are 1 answers

0
Joke coder On BEST ANSWER

This is what I came up with:

var activeItemIndex = 0
Timer.scheduledTimer(withTimeInterval: 5, repeats: true) { timer in
    activeItemIndex += 1
    if activeItemIndex == carousel.numberOfItems {
        activeItemIndex = 0
    }
    carousel.scrollToItem(at: activeItemIndex, duration: 3)
}