Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/davdroman/swiftui-navigation-transitions
Pure SwiftUI Navigation transitions ✨
https://github.com/davdroman/swiftui-navigation-transitions
animation native navigation navigationstack navigationview pure swiftui transition uiviewcontrollertransitioningdelegate
Last synced: 4 days ago
JSON representation
Pure SwiftUI Navigation transitions ✨
- Host: GitHub
- URL: https://github.com/davdroman/swiftui-navigation-transitions
- Owner: davdroman
- License: mit
- Created: 2022-10-18T12:10:50.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-07-19T20:09:00.000Z (4 months ago)
- Last Synced: 2024-10-13T14:47:05.739Z (21 days ago)
- Topics: animation, native, navigation, navigationstack, navigationview, pure, swiftui, transition, uiviewcontrollertransitioningdelegate
- Language: Swift
- Homepage:
- Size: 263 KB
- Stars: 812
- Watchers: 7
- Forks: 34
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-ios - NavigationTransitions - Pure SwiftUI Navigation transitions. (UI / Transition)
- awesome-swift - NavigationTransitions - Pure SwiftUI Navigation transitions. (Libs / UI)
- awesome-swiftui-libraries - NavigationTransitions - Pure SwiftUI Navigation animated transitions (Animation / Content)
- awesome-ios-star - NavigationTransitions - Pure SwiftUI Navigation transitions. (UI / Transition)
- fucking-awesome-swift - NavigationTransitions - Pure SwiftUI Navigation transitions. (Libs / UI)
README
# NavigationTransitions
[![CI](https://github.com/davdroman/swiftui-navigation-transitions/actions/workflows/ci.yml/badge.svg)](https://github.com/davdroman/swiftui-navigation-transitions/actions/workflows/ci.yml)
[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Fdavdroman%2Fswiftui-navigation-transitions%2Fbadge%3Ftype%3Dswift-versions)](https://swiftpackageindex.com/davdroman/swiftui-navigation-transitions)
[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Fdavdroman%2Fswiftui-navigation-transitions%2Fbadge%3Ftype%3Dplatforms)](https://swiftpackageindex.com/davdroman/swiftui-navigation-transitions)
**NavigationTransitions** is a library that integrates seamlessly with SwiftUI's `NavigationView` and `NavigationStack`, allowing complete customization over **push and pop transitions**!
## Overview
Instead of reinventing the entire navigation stack just to control its transitions, `NavigationTransitions` ships with a **simple modifier** that can be applied directly to SwiftUI's very own **first-party navigation** components.
### The Basics
#### iOS 13+
```swift
NavigationView {
// ...
}
.navigationViewStyle(.stack)
.navigationTransition(.slide)
```#### iOS 16+
```swift
NavigationStack {
// ...
}
.navigationTransition(.slide)
```---
The API is designed to resemble that of built-in SwiftUI Transitions for maximum **familiarity** and **ease of use**.
You can apply **custom animations** just like with standard SwiftUI transitions:
```swift
.navigationTransition(
.fade(.in).animation(.easeInOut(duration: 0.3))
)
```You can **combine** them:
```swift
.navigationTransition(
.slide.combined(with: .fade(.in))
)
```And you can **dynamically** choose between transitions based on logic:
```swift
.navigationTransition(
reduceMotion ? .fade(.in).animation(.linear) : .slide(.vertical)
)
```### Transitions
The library ships with some **standard transitions** out of the box:
- [`default`](Sources/NavigationTransition/Default.swift)
- [`fade(_:)`](Sources/NavigationTransition/Fade.swift)
- [`slide(axis:)`](Sources/NavigationTransition/Slide.swift)In addition to these, you can create fully [**custom transitions**](https://davdroman.github.io/swiftui-navigation-transitions/main/documentation/navigationtransitions/custom-transitions/) in just a few lines of SwiftUI-like code!
```swift
struct Swing: NavigationTransition {
var body: some NavigationTransition {
Slide(axis: .horizontal)
MirrorPush {
let angle = 70.0
let offset = 150.0
OnInsertion {
ZPosition(1)
Rotate(.degrees(-angle))
Offset(x: offset)
Opacity()
Scale(0.5)
}
OnRemoval {
Rotate(.degrees(angle))
Offset(x: -offset)
}
}
}
}
```The [**Demo**](Examples/Demo) app showcases some of these transitions in action.
### Interactivity
A sweet additional feature is the ability to override the behavior of the **pop gesture** on the navigation view:
```swift
.navigationTransition(.slide, interactivity: .pan) // full-pan screen gestures!
```This even works to override its behavior while maintaining the **default system transition** in iOS:
```swift
.navigationTransition(.default, interactivity: .pan) // ✨
```## Documentation
The documentation for releases and `main` are available here:
- [`main`](https://swiftpackageindex.com/davdroman/swiftui-navigation-transitions/main/documentation/navigationtransitions)
- [0.13.3](https://swiftpackageindex.com/davdroman/swiftui-navigation-transitions/0.13.3/documentation/navigationtransitions)Other versions
- [0.13.2](https://swiftpackageindex.com/davdroman/swiftui-navigation-transitions/0.13.2/documentation/navigationtransitions)
- [0.13.1](https://swiftpackageindex.com/davdroman/swiftui-navigation-transitions/0.13.1/documentation/navigationtransitions)
- [0.13.0](https://swiftpackageindex.com/davdroman/swiftui-navigation-transitions/0.13.0/documentation/navigationtransitions)
- [0.12.0](https://swiftpackageindex.com/davdroman/swiftui-navigation-transitions/0.12.0/documentation/navigationtransitions)
- [0.11.0](https://swiftpackageindex.com/davdroman/swiftui-navigation-transitions/0.11.0/documentation/navigationtransitions)
- [0.10.1](https://swiftpackageindex.com/davdroman/swiftui-navigation-transitions/0.10.1/documentation/navigationtransitions)
- [0.10.0](https://swiftpackageindex.com/davdroman/swiftui-navigation-transitions/0.10.0/documentation/navigationtransitions)
- [0.9.3](https://swiftpackageindex.com/davdroman/swiftui-navigation-transitions/0.9.3/documentation/navigationtransitions)
- [0.9.2](https://swiftpackageindex.com/davdroman/swiftui-navigation-transitions/0.9.2/documentation/navigationtransitions)
- [0.9.1](https://swiftpackageindex.com/davdroman/swiftui-navigation-transitions/0.9.1/documentation/navigationtransitions)
- [0.9.0](https://swiftpackageindex.com/davdroman/swiftui-navigation-transitions/0.9.0/documentation/navigationtransitions)
- [0.8.1](https://swiftpackageindex.com/davdroman/swiftui-navigation-transitions/0.8.1/documentation/navigationtransitions)
- [0.8.0](https://swiftpackageindex.com/davdroman/swiftui-navigation-transitions/0.8.0/documentation/navigationtransitions)
- [0.7.4](https://swiftpackageindex.com/davdroman/swiftui-navigation-transitions/0.7.4/documentation/navigationtransitions)
- [0.7.3](https://swiftpackageindex.com/davdroman/swiftui-navigation-transitions/0.7.3/documentation/navigationtransitions)
- [0.7.2](https://swiftpackageindex.com/davdroman/swiftui-navigation-transitions/0.7.2/documentation/navigationtransitions)
- [0.7.1](https://swiftpackageindex.com/davdroman/swiftui-navigation-transitions/0.7.1/documentation/navigationtransitions)
- [0.7.0](https://swiftpackageindex.com/davdroman/swiftui-navigation-transitions/0.7.0/documentation/navigationtransitions)
- [0.6.0](https://swiftpackageindex.com/davdroman/swiftui-navigation-transitions/0.6.0/documentation/navigationtransitions)
- [0.5.1](https://swiftpackageindex.com/davdroman/swiftui-navigation-transitions/0.5.1/documentation/navigationtransitions)