Composable Navigation: Destinations

Episode #228 • Mar 27, 2023 • Subscriber-Only

While we just tackled drill-down navigation, sadly the API we used was deprecated in iOS 16. Let’s get things working with the new navigationDestination view modifier, and see what testing in the Composable Architecture has to say about navigation.

Previous episode
Composable Navigation: Destinations
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

Stephen

OK, I feel like we’ve said this too many times in this series of episodes but we can’t help say it again: this stuff is really incredible.

We have now built tools to support 6 different forms of navigation: alerts, confirmation dialogs, sheets, popovers, covers and now navigation links. Sure, it was the deprecated form of navigation links, but it’s still really impressive stuff.

If you’re willing to put in a little bit of upfront domain modeling work when building your features, then you get to treat all of these forms of navigation as all basically the same thing. You just have some optional state, you invoke a reducer operator to integrate a child feature with the parent, and you invoke a method in the view layer to integrate a child view with the parent.

Brandon

But once you do that there are massive benefits. Parent and child domains get a really simple way to communicate with each other. Just a moment ago we saw that the parent inventory feature could instantly see every edit made to an item inside the ItemFormFeature, and used that power in order to update the items collection instantly. And deep linking basically just comes along for free.

Testing is another super power that is unlocked once you perform the upfront work. We’ve seen this time and time again so far in this series, but let’s do it again.

Testing links


References

Downloads

Get started with our free plan

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

View plans and pricing