Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default UINavigationController animation? #43

Open
kutakmir opened this issue Feb 10, 2021 · 2 comments
Open

Default UINavigationController animation? #43

kutakmir opened this issue Feb 10, 2021 · 2 comments

Comments

@kutakmir
Copy link

Hi, quick question - how do I replicate the default NavigationView's transition animation?

It's not a plain .slide, it's both slide and slide of the original one at a half distance.

@matteopuc
Copy link
Owner

matteopuc commented Feb 12, 2021

Hi @kutakmir, thanks for this interesting question. I'd like to have the actual default animation too, but at the moment I can't manage to do it. Basically you should try to play with the defaultTransitions property in the NavigationStack.swift file. If I try to write something like this (100 is just an example of course):

public static var defaultTransitions: (push: AnyTransition, pop: AnyTransition) {
    let pushTrans = AnyTransition.asymmetric(insertion: .move(edge: .trailing), removal: .offset(x: -100))
    let popTrans = AnyTransition.asymmetric(insertion: .offset(x: -100), removal: .move(edge: .trailing))
    return (pushTrans, popTrans)
}

The outcome is not the expected one. I think it is something related to this (still open) issue: #17

@davidscheutz
Copy link

davidscheutz commented Feb 19, 2023

Hey @kutakmir, depending on your use case I created a much simpler SwiftUI navigation library that basically wraps the UINavigation controller and makes programmatic navigation super easy. You get exactly the benefit mentioned above, the native iOS push transition including the drag to dismiss gesture.

Feel free to take a look here: https://github.com/davidscheutz/swiftui-infinite-navigation 😊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants