Composing View Controllers pt.3: Lifecycle Observers in Swift

Caio Zullo
Essential Developer — iOS
1 min readAug 2, 2018
Watch on YouTube

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.

Follow us on: YouTubeTwitterFacebookGitHub

--

--

Caio Zullo
Essential Developer — iOS

I love building robust, well-engineered, and beautiful iOS applications and coaching developers to achieve their best potential @ https://essentialdeveloper.com