juanpablofernandez / SwiftyOnboard

A swifty iOS framework that allows developers to create beautiful onboarding experiences.
MIT License
1.25k stars 105 forks source link

how to use auto slide onboarding? #29

Open iOS-dev-avinash opened 6 years ago

iOS-dev-avinash commented 6 years ago

i want to use auto slide in every 3 second

monkeywithacupcake commented 6 years ago

I think you could change the logic such that there is a time trigger. This means that in your ViewController where you invoke SwiftyOnboard, you want to have a function that watches for time and chagnes to the next indexed page. Look at the delegate methods in the example to see how it works for the continue on slide.

If you are going to change underlying behavior as well, it is best if you don't use the pod but use a manual copying of the main files.

Apple Wait docs

hemangshah commented 5 years ago

@avikhairgavepatil

You can implement this like this:

Define variables like this:

let numberOfPages = 5
let swiftyOnboard: SwiftyOnboard!
        Timer.scheduledTimer(withTimeInterval: 3.0, repeats: true) { (timer) in
            let currentPage = self.swiftyOnboard.currentPage
            if currentPage >= numberOfPages {
                timer.invalidate()
            } else {
                self.swiftyOnboard.goToPage(index: currentPage + 1, animated: true)
            }
        }

Maybe you need to disable user swiping by setting shouldSwipe to false as you're changing the page using Timer.