Post

Replies

Boosts

Views

Activity

Reply to SwiftUI Navigation link issue
The problem is that you have NavigationLink placed in the ForEach cycle! You need to remove NavigationLink from the cycle and transfer the necessary data there, for example, through the view model. Summary: you must have only one NavigationLink with the "IsActive" parameter. My original answer - https://stackoverflow.com/questions/66017531/swiftui-navigationlink-bug-swiftui-encountered-an-issue-when-pushing-anavigatio/67626758#67626758
May ’21
Reply to SwiftUI 4 navigation bug on iOS 16?
This one will work: You need to use NavigationLink with an activation parameter so that you can track the start of navigation. When switching the navigation link activation parameter, force the keyboard to be removed extension UIApplication: UIGestureRecognizerDelegate { func dismissKeyboard() { sendAction(#selector(UIResponder.resignFirstResponder), to: nil, from: nil, for: nil) } } Button {     UIApplication.shared.dismissKeyboard()     activateLink = true } label: { Text("Activate link") } .background( NavigationLink(destination: DestinationView(), isActive: $activateLink) { EmptyView()} ) In iOS 15, there are no such problems.
Oct ’22