1

I am working on app supporting iOS 13 using SwiftUI, I have custom activity indicator(UIViewRepresentable) on which is displayed on Api call

In main screen where I have created NavigationView, on top of that I am able to add the activity indicator view which is able to cover the navigation bar also,

But in detail view which is navigated using navigation link, I tried the same code but the activity indicator view is displayed below navigation bar(which is not covering the navigation bar)

struct DetailView: View {

@State private var show = false

var body: some View {
    ZStack {
        Button("showSpinner") {
            self.show.toggle()
        }
    }
    .modifier(CoverNavigationBar(show: $show) {
        CustomActiviyIndicatorView()
            .edgesIgnoringSafeArea(.all)
    })
    
} }

struct CoverNavigationBar<Cover: View>: ViewModifier {

@Binding var show: Bool
let cover: () -> Cover

func body(content: Content) -> some View {
    ZStack {
        content
        if self.show {
            cover()
        }
    }
} }
Rama Krish
  • 373
  • 1
  • 13

0 Answers0