aromajoin / material-showcase-ios

✨ An elegant way to guide your beloved users in iOS apps - Material Showcase.
https://aromajoin.com/
Other
363 stars 128 forks source link

MaterialShowcase delegate method is not being called. #58

Closed manasmahala closed 6 years ago

manasmahala commented 6 years ago

showcase.delegate = self MaterialShowcase delegate method is not being called.

alexprazeres commented 6 years ago

I had the same issue. Solved it by putting this inside viewController class

    func showCaseDidDismiss(showcase: MaterialShowcase) {
        //do what you want
    }

    func showCaseWillDismiss(showcase: MaterialShowcase) {
        //do what you want
    }

and also this outside

extension myViewController: MaterialShowcaseDelegate {
    func showCaseWillDismiss(showcase: MaterialShowcase, didTapTarget: Bool) {
    }
    func showCaseDidDismiss(showcase: MaterialShowcase, didTapTarget: Bool) {
    }
}
quangctkm9207 commented 6 years ago

@alexprazeres : Thank you for helping out. @manasmahala : Besides, you can check out the Sample app which shows the steps to handle ShowcaseDelegate. https://github.com/aromajoin/material-showcase-ios/blob/c206da67c597f0f38ded95543da70e31940c1bef/Sample/MaterialShowcaseSample/ViewController.swift#L116

Effe76 commented 6 years ago

Hi,

I tried your sample app and the delegate methods were not being called

extension ViewController: MaterialShowcaseDelegate {
  func showCaseWillDismiss(showcase: MaterialShowcase) {
  }
  func showCaseDidDismiss(showcase: MaterialShowcase) {
  }
}

After having a quick look in the code I found out that in the completeShowcase method the delegate tries to call

delegate?.showCaseWillDismiss?(showcase: self, didTapTarget: didTapTarget)
delegate?.showCaseDidDismiss?(showcase: self, didTapTarget: didTapTarget)

The didTapTarget: parameter was missing, I write it here because it may be useful to someone else before you update the sample app

Thanks