Tuesday, March 19, 2024
HomeiOS Developmentios - ForEach inside NavigationLink with @Atmosphere(.dismiss) makes the nav hyperlink unclickable/unresponsive

ios – ForEach inside NavigationLink with @Atmosphere(.dismiss) makes the nav hyperlink unclickable/unresponsive


I got here throughout this problem whereas writing an app, so I remoted the issue to the only type I might consider under.

The principle problem appears to be that if I’ve a ForEach inside a NavigationLink inside a baby view struct the place I’ve outlined @Atmosphere(.dismiss) var dismiss, then I’m unable to click on the NavigationLink to maneuver to the brand new View in Canvas, on Simulator and on an actual iPhone.

import SwiftUI

struct ContentView: View {
    var physique: some View {
        VStack {
            NavigationStack {
                ChildView()
            }
        }
        .padding()
    }
}

struct ChildView: View {
    //Commenting the @Atmosphere(.dismiss) line under appears repair it
    @Atmosphere(.dismiss) var dismiss
    
    var physique: some View {
        VStack {
            NavigationLink("Commend and uncomment @Atmosphere") {
                ForEach(1...5, id: .self) { index in
                    Textual content("demo (index)")
                }
            }
        }
    }
}

#Preview {
    ContentView()
}

Am I doing one thing incorrect? Does this appear to be a bug?

Swift language model: 5
iOS goal model: 17.4
Xcode model: 15.3 (15E204a)



Supply hyperlink

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments