Composing View Controllers pt.3: Lifecycle Observers in Swift
In this video, you’ll learn how to create your own Swift View Controller Lifecycle Observers
. Those observers are very useful when composing and creating reusable view controllers. For example:
controller.onViewDidAppear(run: ItemsAnalytics.reportPageView)
The solution is based on the UIViewController Containers API
so there's no need for external frameworks, swizzling or subclassing!
You can find the source code on GitHub.
Learn more about Implementing a Container View Controller from Apple Docs
Subscribe now to our Youtube channel and catch free new episodes every week.
Originally published at www.essentialdeveloper.com.
Let’s connect
If you enjoyed this article, visit us at https://essentialdeveloper.com and get more in-depth tailored content like this.