Skip to content
This repository was archived by the owner on Apr 30, 2025. It is now read-only.
This repository was archived by the owner on Apr 30, 2025. It is now read-only.

Question: Showcases as UIViewController delegate? #1

@groue

Description

@groue

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions