Modern UIKit: Basics of Navigation

Episode #284 • Jun 24, 2024 • Subscriber-Only

Now that we have a tool that brings the power of the Observation framework to UIKit, let’s put it through the paces. We will use it to build state-driven navigation tools that can drive alerts, sheets, popovers, drill-downs, and more, and they will look a lot like SwiftUI’s navigation tools.

Previous episode
Modern UIKit: Basics of Navigation
Next episode
Locked

Unlock This Episode

Our Free plan includes 1 subscriber-only episode of your choice, plus weekly updates from our newsletter.

Sign in with GitHub

Introduction

Brandon

So this is pretty incredible. Not only do we have an amazing observation tool for UIKit, but it also works on basically any version of iOS released in the past 5 years. And it didn’t take much work for us to accomplish this. It’s all thanks to Swift’s observation tools and our back-port of the those tools.

Stephen

But now it’s time to push these tools even harder, because so far our app is very simple. We are just setting up some labels and conditionally showing and hiding certain components. Things start getting really interesting when we think about navigation. And as we’ve all learned from SwiftUI, it is great to drive navigation from state rather than it being a “fire-and-forget” occurrence.

Driving navigation from state allows your features to inspect the exact state of your app at any moment, makes it easy to deep-link into any screen of your application, and also makes it easy to write tests that show how multiple features integrate together.

What does it take to perform state-driven navigation in UIKit? Well, not only is possible, but it’s even pretty easy to accomplish, and it’s really incredible to see. We really can build complex navigation flows in a UIKit application in a very similar manner that we do for SwiftUI.

Let’s take a look.

State-driven navigation


References

Downloads

Get started with our free plan

Our free plan includes 1 subscriber-only episode of your choice, access to 64 free episodes with transcripts and code samples, and weekly updates from our newsletter.

View plans and pricing