Collection
Unlock This Episode
Our Free plan includes 1 subscriber-only episode of your choice, plus weekly updates from our newsletter.
Introduction
So, we’ve now cooked up a new initializer on NavigationLink
that brings it more in line with how sheets and popovers work. You just hand it a binding of an optional, and when that binding flips to something non-nil
the binding is transformed into a binding of an honest value, and that binding is handed to your destination so that it can do whatever it wants with it. It’s pretty cool that all of these seemingly disparate kinds of navigation are really just all driven off the same concept, which is optional state, or more generally enums.
However, there’s another initializer on NavigationLink
that is quite different from any of the other ones. We’ve already seen the fire-and-forget initializer, the boolean binding initializer, and then we just cooked up an optional binding initializer, but this other one takes two pieces of information: something called a “tag” and something called a “selection.”
Subscribe to Point-Free
Access this episode, plus all past and future episodes when you become a subscriber.
Already a subscriber? Log in
References
SwiftUI Navigation
Brandon Williams & Stephen Celis • Tuesday Nov 16, 2021After 9 episodes exploring SwiftUI navigation from the ground up, we open sourced a library with all new tools for making SwiftUI navigation simpler, more ergonomic and more precise.
WWDC 2021: Demystifying SwiftUI
Matt Ricketson, Luca Bernardi & Raj Ramamurthy • Wednesday Jun 9, 2021An in-depth explaining on view identity, lifetime, and more, and crucial to understanding how @State
works.
Collection: Derived Behavior
Brandon Williams & Stephen Celis • Monday May 17, 2021The ability to break down applications into small domains that are understandable in isolation is a universal problem, and yet there is no default story for doing so in SwiftUI. We explore the problem space and solutions, in both vanilla SwiftUI and the Composable Architecture.