Post

Replies

Boosts

Views

Activity

Reply to SwiftUI iOS 15 NavigationLink pops out when press in textfield
My navigation was auto to pop after I presented a sheet. I used solution of @ArutyunSWAG, and made it shorter. Hope it can help someone. import SwiftUI import Introspect struct NavigationLinkImplement<Destination: View, Label: View>: View {   let destination: () -> Destination   @ViewBuilder let label: () -> Label   @State private var isActive = false   @State private var nav: UINavigationController?       var body: some View {     Button(action: action, label: label)       .introspectNavigationController { nav in         self.nav = nav       }   }       func action() {     let dest = UIHostingController<Destination>(rootView: destination())     nav?.pushViewController(dest, animated: true)   } }
Apr ’22