0

I'm in the midst of moving my app from iOS 15 to iOS 16.

In my app ( iOS 15 ) I have a LogOn View (sysPassView) that automatically pops on first entry into my Navigation View using the following code:

NavigationView {

@State private var showLogin: Bool = true

NavigationLink("", destination: sysPassView( showLogin: $showLogin).environmentObject(defaults), isActive: $showLogin) EmptyView()

}

In moving my app to iOS 16, I am getting this message related to the NavigationLink:

'init(:destination:isActive:)' was deprecated in iOS 16.0: use NavigationLink(:value:) inside a NavigationStack or NavigationSplitView

I made the following changes to convert my NavigationView to a NavigationStack:

@State private var showLogin: Bool = true

NavigationStack {

.navigationDestination(isPresented: $showLogin) {

sysPassView(showLogin: $showLogin).environmentObject(defaults)

}

This is not automatically popping the Logon View as it did with the NavigationLink.

Appreciate any suggestions on how to address this.

SamCodes
  • 13
  • 3

1 Answers1

0
@State private var showLogin: Bool = false

NavigationStack {
    
    VStack {
        
        Button("Show Login") {
            showLogin = true
        }
        
    }
    .navigationDestination(isPresented: $showLogin) {
        sysPassView(showLogin: $showLogin).environmentObject(defaults)
    }
}
devdchaudhary
  • 467
  • 2
  • 13