NEW: Learn to build amazing SwiftUI apps for macOS with my new book! >>

How to dismiss using NavigationLink isActive in a List

Forums > SwiftUI

This refers to the "Complete Guide to NavigationView in SwiftUI".

I cannot find a solution to dismiss a detail view without using the environemnt variable presentationMode when using NavigationLink inside a list. According to Apple dev forums, it is not supported to use NavigationLink( isActive: ) inside of a List.

How can I push a view for an array of items and still dismiss the detail view programmatically?

Any hints? Thank you!

1      

Did you try passing the boolean binding (used in isActive) to the detail view and then setting it to false when you want to dismiss it? This should work the same way as the presentationMode environment.

Otherwise it would be helpful to have a small piece of code illustrating what your issue is.

1      

Hacking with Swift is sponsored by RevenueCat

SPONSORED Spend less time managing in-app purchase infrastructure so you can focus on building your app. RevenueCat gives everything you need to easily implement, manage, and analyze in-app purchases and subscriptions without managing servers or writing backend code.

Get Started

Sponsor Hacking with Swift and reach the world's largest Swift community!

Reply to this topic…

You need to create an account or log in to reply.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.