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:
- Present the showcases
- Search for a single showcase name
- Visit this showcase
- Quit the app
- Relaunch the app, present showcases again
- See how the previous showcase is automatically displayed (🤩)
- 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
Hello,
We sometimes use Showcases as a delegate of the view controller returned by
makeViewController(), in order to implement behaviors. For example:It works perfectly well, but in one situation:
In all other situations, the delegate callback is properly invoked.
When debugging, we discover that the
MyControllerShowcaseinstance is deinitialized fromShowcasesViewController.viewDidAppear(_:)in the faulty scenario.What is your opinion?
MyControllerShowcase?FYI: we're using ShowcaseKit 1.1.2.
cc @pakko972