UIPilot Navigation Library

repository·main·Indexed 43 days ago

https://github.com/canopas/uipilot

A lightweight, type-safe navigation library for SwiftUI that provides a router-based API inspired by Android and Flutter. It wraps standard SwiftUI/UIKit navigation to ensure compatibility with native gestures and features, offering compile-time safety to prevent runtime routing errors. Version 2.x utilizes UINavigationController for improved navigation behavior.

Tokens
387
Snippets
2
Records
3
Agent score
6%

What's inside UIPilot

  1. What is UIPilot and how does it work?

    main

    UIPilot is a lightweight SwiftUI navigation wrapper (barely 200 lines of code) designed to provide a more intuitive routing experience inspired by Android, Flutter, and web-based routers.

    Key characteristics:

    • Not a replacement for SwiftUI navigation: It acts as a wrapper. Version 1.x uses NavigationView, while Version 2.x (recommended) uses UINavigationController underneath. This ensures standard features like titles, swipe gestures, and top bars are available by default.
    • Type-safe Routing: Navigation paths and parameters are checked at compile time, preventing runtime crashes caused by incorrect routing.
    • Composable/Nested Navigation: You can nest UIPilot instances as many times as needed to achieve complex layouts, such as split-screen behavior.
  2. Install UIPilot via Swift Package Manager

    main

    To add UIPilot to your Swift project using Swift Package Manager, add the repository URL to your Package.swift dependencies. It is recommended to use version 2.x, which uses UINavigationController underneath for improved navigation behavior.

    dependencies: [
        .package(url: "https://github.com/canopas/UIPilot.git", .upToNextMajor(from: "2.0.2"))
    ]