Tawa / TNTutorialManager

Tutorial Handler that helps you implement interactive on boarding and tutorials inside your iOS Apps.
MIT License
108 stars 6 forks source link

Returning false from tutorialAcceptTapsOnHighlightsOnly() does not work. #10

Closed shirakaba closed 6 years ago

shirakaba commented 6 years ago

Version

1.3.1

Code

func tutorialAcceptTaps(onHighlightsOnly index: Int) -> Bool {
    return false
}

Expected behaviour

Should be able to click on any dark part of the screen to advance the tutorial.

Actual behaviour

Whether I return true or false from the delegate, I must click in the highlighted area in order to advance the tutorial.

This is true regardless of whether tutorialViewsToHighlight() has returned an empty or filled array of UIViews.

Interestingly, if I comment-out the delegate completely, I am able to click anywhere at all to advance the tutorial.

Conclusion

The functionality to accept taps in all areas (including dark areas) works only if the delegate is not implemented. However, when the delegate is implemented, then tutorialAcceptTapsOnHighlightsOnly() ignores my return value, overriding it with return true.

shirakaba commented 6 years ago

Okay, I've solved it. In tutorialViewsToHighlight(), I was returning [] rather than nil when I wanted to specify "no UIViews to be highlighted".

    func tutorialViews(toHighlight index: Int) -> [UIView]! {
        switch(index){
        case 0:
            return []
        case 1:
            return [toolbarMimicStack.arrangedSubviews[0], toolbarMimicStack.arrangedSubviews[1]]
        default:
            return []
        }
    }

I've created pull request #11 to enable the user to enter either nil or [].