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

Question: Showcases as UIViewController delegate? #1

Open
groue opened this issue Jun 29, 2020 · 0 comments
Open

Question: Showcases as UIViewController delegate? #1

groue opened this issue Jun 29, 2020 · 0 comments

Comments

@groue
Copy link

groue commented Jun 29, 2020

Hello,

We sometimes use Showcases as a delegate of the view controller returned by makeViewController(), in order to implement behaviors. For example:

class MyControllerShowcase: Showcase, MyControllerDelegate {
    func makeViewController() -> UIViewController {
        let controller = MyController(...)
        controller.delegate = self
        return controller
    }

    func myControllerDidFrobnicate(_ controller: MyController) {
        // stuff
    }
}

It works perfectly well, but in one situation:

  1. Present the showcases
  2. Search for a single showcase name
  3. Visit this showcase
  4. Quit the app
  5. Relaunch the app, present showcases again
  6. See how the previous showcase is automatically displayed (🤩)
  7. The delegate callback is not invoked (😢)

In all other situations, the delegate callback is properly invoked.

When debugging, we discover that the MyControllerShowcase instance is deinitialized from ShowcasesViewController.viewDidAppear(_:) in the faulty scenario.

What is your opinion?

  • Was it a mistake to rely on a living instance of MyControllerShowcase?
  • Do we have any alternative in order to use delegate (or datasources) in showcases?

FYI: we're using ShowcaseKit 1.1.2.

cc @pakko972

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

1 participant