Site icon TechHype.io

SwiftUI Navigation – Tools for making SwiftUI navigation simpler

Tools for making SwiftUI navigation simpler, more ergonomic and more precise.

Overview

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:

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:

Examples

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:

Learn More

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.

Installation

You can add SwiftUI Navigation to an Xcode project by adding it as a package dependency.

https://github.com/pointfreeco/swiftui-navigation

If you want to use SwiftUI Navigation in a SwiftPM project, it’s as simple as adding it to a dependencies clause in your Package.swift:

dependencies: [
  .package(url: "https://github.com/pointfreeco/swiftui-navigation", from: "0.4.5")
]

Documentation

The latest documentation for the SwiftUI Navigation APIs is available here.

SwiftUI Navigation on GitHub: https://github.com/pointfreeco/swiftui-navigation
Platform: iOS
⭐️: 1.2K
Exit mobile version