Tools for making SwiftUI navigation simpler, more ergonomic and more precise.
SwiftUI comes with many forms of navigation (tabs, alerts, dialogs, modal sheets, popovers, navigation links, and more), and each comes with a few ways to construct them. These ways roughly fall in two categories:
“Fire-and-forget”: These are initializers and methods that do not take binding arguments, which means SwiftUI fully manages navigation state internally. This makes it easy to get something on the screen quickly, but you also have no programmatic control over the navigation. Examples of this are the initializers on
NavigationLinkthat do not take a binding.
“State-driven”: Most other initializers and methods do take a binding, which means you can mutate state in your domain to tell SwiftUI when it should activate or deactivate navigation. Using these APIs is more complicated than the “fire-and-forget” style, but doing so instantly gives you the ability to deep-link into any state of your application by just constructing a piece of data, handing it to a SwiftUI view, and letting SwiftUI handle the rest.
Navigation that is “state-driven” is the more powerful form of navigation, albeit slightly more complicated, but unfortunately SwiftUI does not ship with all the tools necessary to model our domains as concisely as possible and use these navigation APIs.
Unfortunately, SwiftUI does not ship with all of the tools necessary to model our domains with enums and make use of navigation APIs. This library bridges that gap by providing APIs that allow you to model your navigation destinations as an enum, and then drive navigation by a binding to that enum.
Explore all of the tools this library comes with by checking out the documentation, and reading these articles:
- What is navigation?: Learn how one can think of navigation as a domain modeling problem, and how that leads to the creation of concise and testable APIs for navigation.
- Navigation links and destinations: Learn how to drive navigation in NavigationView and NavigationStack in a concise and testable manner.
- Sheets, popovers, and covers: Learn how to present sheets, popovers and covers in a concise and testable manner.
- Alerts and dialogs: Learn how to present alerts and confirmation dialogs in a concise and testable manner.
- Bindings: Learn how to manage certain view state, such as
@FocusStatedirectly in your observable object.
This repo comes with lots of examples to demonstrate how to solve common and complex navigation problems with the library. Check out this directory to see them all, including:
- Case Studies
- Alerts & Confirmation Dialogs
- Sheets & Popovers & Fullscreen Covers
- Navigation Links
- Custom Components
- Inventory: A multi-screen application with lists, sheets, popovers and alerts, all driven by state and deep-linkable.
SwiftUI Navigation’s tools were motivated and designed over the course of many episodes on Point-Free, a video series exploring functional programming and the Swift language, hosted by Brandon Williams and Stephen Celis.
You can watch all of the episodes here.
You can add SwiftUI Navigation to an Xcode project by adding it as a package dependency.
If you want to use SwiftUI Navigation in a SwiftPM project, it’s as simple as adding it to a
dependencies clause in your
dependencies: [ .package(url: "https://github.com/pointfreeco/swiftui-navigation", from: "0.4.5") ]
The latest documentation for the SwiftUI Navigation APIs is available here.
Mobile App Development Best Practices – 27.09
Swipe Actions from Scratch, Effective code reviews for Android developers, WebP exploit and more!
SwiftUI Swipe Actions from Scratch
So let's build our own version from scratch that will thrive in any context!
WatchOS 10 Heart App Animation Using SwiftUI
In this video, I’m going to show how to create the WatchOS 10 Heart App Animation Using SwiftUI.
PartyKit implements real-time multiuser interaction for any application
"The idea is to make real-time multiplayer development available to millions of developers around the world, and the only way...
Gallery – Media Gallery app with Jetpack Compose
Gallery – Light-weight Media Gallery app for Android made with Jetpack Compose.
Moloco Mobile App Performance Marketing Global Report
Now, more than ever, marketing leaders are held accountable for tangible business outcomes and optimal return on advertising spend.