I use viewModifier to make my view to build non clickable(I can click the view behind upper non clickable view)
struct NoHitTesting: ViewModifier {
func body(content: Content) -> some View {
SwiftUIWrapper { content }.allowsHitTesting(false)
}
}
extension View {
func userInteractionDisabled() -> some View {
self.modifier(NoHitTesting())
}
}
struct SwiftUIWrapper<T: View>: UIViewControllerRepresentable {
let content: () -> T
func makeUIViewController(context: Context) -> UIHostingController<T> {
UIHostingController(rootView: content())
}
func updateUIViewController(_ uiViewController: UIHostingController<T>, context: Context) {}
}
and I also made navigation view and navigation link. trying to make navigation bar hidden.
@EnvironmentObject var shared : SharedStatus
var body: some View {
NavigationView{
VStack{
NavigationLink(destination: View2())
{
Text("Its First")
}
Spacer()
}.nvHid()
}
}
}
extension View{
func nvHid() -> some View{
return self.navigationTitle("").navigationBarBackButtonHidden(true).navigationBarHidden(true)
}
}
struct View2 : View{
var body : some View{
VStack{
NavigationLink(destination: View3())
{
Text("Its second")
}
Text("hahah").userInteractionDisabled()
Spacer()
}.nvHid()
}
}
but still navigation bar remains.
how can I fix it..?