Skip to content

Latest commit

 

History

History
79 lines (53 loc) · 1.78 KB

File metadata and controls

79 lines (53 loc) · 1.78 KB

AsyncNavigationKit

AsyncNavigationKit provides small, focused async wrappers around common UIKit navigation and presentation APIs. The goal is to make flow control in UIKit more predictable when transitions are animated.

Requirements

  • iOS 16+
  • Swift 6.2+ (SwiftPM tools version 6.2)

Installation

Add the package to your SwiftPM dependencies:

// Package.swift
.package(url: "https://github.com/<your-org>/swift-AsyncNavigationKit", from: "0.1.0")

Then add AsyncNavigationKit to the target dependencies that need it.

Usage

UIViewController

import AsyncNavigationKit

await presentAsync(DetailViewController(), animated: true)
await dismissAsync(animated: true)

UINavigationController

import AsyncNavigationKit

await navigationController.pushViewControllerAsync(
  viewController: DetailViewController(),
  animated: true
)

await navigationController.popViewControllerAsync(animated: true)

UITabBarController

import AsyncNavigationKit

await tabBarController.select(index: 2)
await tabBarController.select(SettingsViewController.self)

await tabBarController.popAsync(animated: true)
await tabBarController.pushAsync(DetailViewController(), animated: true)
await tabBarController.popAndPushAsync(DetailViewController(), animated: true)

Notes

  • UITabBarController helpers assume viewControllers is set and that each tab is either a UINavigationController or a view controller of the target type.
  • popAsync, pushAsync, and popAndPushAsync assume the selected tab is a UINavigationController.

Documentation

API documentation is provided via DocC in Sources/AsyncNavigationKit/Documentation.docc. On macOS, you can generate the docs with:

swift package generate-documentation

License

MIT