Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

License

NotificationsYou must be signed in to change notification settings

yapstudios/swiftui-navigation

 
 

Repository files navigation

CISlack

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 roughlyfall in two categories:

  • "Fire-and-forget": These are initializers and methods that do not take binding arguments, whichmeans SwiftUI fully manages navigation state internally. This makes it easy to get something onthe screen quickly, but you also have no programmatic control over the navigation. Examples ofthis are the initializers onTabView andNavigationLinkthat do not take a binding.

  • "State-driven": Most other initializers and methods do take a binding, which means you canmutate 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 instantlygives you the ability to deep-link into any state of your application by just constructing apiece 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 morecomplicated. Unfortunately, SwiftUI does not ship with all of the tools necessary to model our domains withenums and make use of navigation APIs. This library bridges that gap by providing APIs that allowyou to model your navigation destinations as an enum, and then drive navigation by a bindingto that enum.

Explore all of the tools this library comes with by checking out thedocumentation, andreading these articles:

  • What is navigation?:Learn how one can think of navigation as a domain modeling problem, and how that leads to thecreation of concise and testable APIs for navigation.

  • Navigation links and destinations:Learn how to drive navigation in NavigationView and NavigationStack in a concise and testablemanner.

  • 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@FocusState directly in your observable object.

Examples

This repo comes with lots of examples to demonstrate how to solve common and complex navigationproblems with the library. Check outthis directory to see them all, including:

  • Case Studies
    • Alerts & Confirmation Dialogs
    • Sheets & Popovers & Fullscreen Covers
    • Navigation Links
    • Routing
    • Custom Components
  • Inventory: A multi-screen application with lists, sheets, popovers andalerts, all driven by state and deep-linkable.

Learn More

SwiftUI Navigation's tools were motivated and designed over the course of many episodes onPoint-Free, a video series exploring functional programming and theSwift language, hosted byBrandon Williams andStephen Celis.

You can watch all of the episodeshere.

video poster image

Community

If you want to discuss this library or have a question about how to use it to solvea particular problem, there are a number of places you can discuss with fellowPoint-Free enthusiasts:

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 aSwiftPM project,it's as simple as adding it to adependencies clause in yourPackage.swift:

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

Documentation

The latest documentation for the SwiftUI Navigation APIs is availablehere.

License

This library is released under the MIT license. SeeLICENSE for details.

About

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

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Swift99.2%
  • Makefile0.8%

[8]ページ先頭

©2009-2025 Movatter.jp