5

I made a simple macOS application with NavigationStack and few views presented using NavigationLink(value:label:). It works really nice, except there is no animation at all. Is it possible to add animations to NavigationStack in this way? I can't use withAnimation {}, because it's not how NavigationLink works.

1
  • Just curious why would you need animation, it is standard functionality and users would like to see to see the view immediately? Instead you could animate the contents of the detail view Dec 2, 2022 at 21:28

1 Answer 1

0

I didn't find a solution with NavigationStack but

Perhaps the solution to this problem will be the use of a Mac Catalyst.

For example, the following forces a stack-based navigation style, overriding the default double-column style on Mac Catalyst:

struct ExampleView: View {
    var body: some View {
        NavigationView {
            NavigationLink("Hello Bananas", destination: Text("🍌🍌"))
        }
        .navigationViewStyle(StackNavigationViewStyle())
    }
}

enter image description here

I would be grateful if there is another solution

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.