Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip and Continue buttons not working #45

Open
miznascene opened this issue Aug 26, 2019 · 1 comment
Open

Skip and Continue buttons not working #45

miznascene opened this issue Aug 26, 2019 · 1 comment

Comments

@miznascene
Copy link

Hi,
The skip and continue buttons are not working. Can you help me with this please?

@Vaintti
Copy link

Vaintti commented Oct 11, 2019

You have to add actions to them. You can tweak them by implementing swiftyOnboardViewForOverlay. Here is an example

@objc private func onContinue() {
    guard let swiftyOnboard = swiftyOnboard else { return }
    swiftyOnboard.goToPage(index: swiftyOnboard.currentPage + 1, animated: true)
}

@objc private func onSkip() {
    // TODO: Add implementation
}

func swiftyOnboardViewForOverlay(_ swiftyOnboard: SwiftyOnboard) -> SwiftyOnboardOverlay? {
    let overlay = SwiftyOnboardOverlay()
    overlay.continueButton.setTitle("continue", for: .normal)
    overlay.continueButton.addTarget(self,action: #selector(onContinue), for: .touchUpInside)
    overlay.skipButton.setTitle("skip", for: .normal)
    overlay.skipButton.addTarget(self, action: #selector(onContinue), for: .touchUpInside)
    return overlay
}

You can also change the functions later with swiftyOnboardOverlayForPosition

func swiftyOnboardOverlayForPosition(_ swiftyOnboard: SwiftyOnboard, overlay: SwiftyOnboardOverlay, for position: Double) {
    overlay.continueButton.removeTarget(self, action: #selector(onDone), for: .touchUpInside)
    overlay.continueButton.removeTarget(self, action: #selector(onContinue), for: .touchUpInside)
    if position == 2 {
        overlay.continueButton.setTitle("done", for: .normal)
        overlay.continueButton.addTarget(self, action: #selector(onDone), for: .touchUpInside)
        return
    }
    overlay.continueButton.setTitle("continue", for: .normal)
    overlay.continueButton.addTarget(self, action: #selector(onContinue), for: .touchUpInside)
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants