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 customize labels and buttons of SwiftyOnboardOverlay or SwiftyOnboard #35

Open IslasGiga opened 6 years ago

IslasGiga commented 6 years ago

I'm trying to customize labels of SwiftyOnboard (change colors, font...) and the skip button, but it's not working.

litsdm commented 5 years ago

@IslasGiga I looked at SwiftyOnBoard's code and it is using an enum that has only .light and .dark, this enum is overriding any colors you are setting on this two functions:

// SwiftyOnBoardOverlay.swift
open func set(style: SwiftyOnboardStyle) {
        switch style {
        case .light:
            continueButton.setTitleColor(.white, for: .normal)
            skipButton.setTitleColor(.white, for: .normal)
            pageControl.currentPageIndicatorTintColor = UIColor.white
        case .dark:
            continueButton.setTitleColor(.black, for: .normal)
            skipButton.setTitleColor(.black, for: .normal)
            pageControl.currentPageIndicatorTintColor = UIColor.black
        }
    }

// SwiftyOnBoardPage.swift
func set(style: SwiftyOnboardStyle) {
        switch style {
        case .light:
            title.textColor = .white
            subTitle.textColor = .white
        case .dark:
            title.textColor = .black
            subTitle.textColor = .black
        }
    }

So you can only change between black and white text for now. I don't have much time to write a PR to fix this right now but I'll try to do it when on my free time. You can also try fixing this issue yourself and submitting the PR!

hemangshah commented 5 years ago

@cdiezmoran, great looking in code! I would suggest you to add custom type for SwiftyOnboardStyle that let devs can use they own style.

spaquet commented 5 years ago

You can create your own overlay too. If you want to cover the changes you just mentioned I would suggest overriding the properties of this objects in swiftyOnboardViewForOverlay as explained in the documentation and the examples.