4

I have a simple SwiftUI view that contains a web view:

struct GetInTouchView: View {
    // MARK: - state
    @State var url: URL
    @State var backgroundColour = Color.login.background
        
    // MARK: - init
    init(url: URL) {
        self._url = .init(wrappedValue: url)
    }
    
    // MARK: - body
    var body: some View {
        ZStack {
            backgroundColour
                .edgesIgnoringSafeArea(.all)
            WebView(url: $url, backgroundColour: $backgroundColour)
                .edgesIgnoringSafeArea(.bottom)
        }
        .environment(\.colorScheme, .light)
        .preferredColorScheme(.light)
        .navigationTitle(NSLocalizedString("Get in touch", comment: "Get in touch"))
        .navigationBarTitleDisplayMode(.inline)
        .navigationBarHidden(false)
    }
}

This view is displayed from a view where the navigation bar is hidden using a navigation link:

let getInTouchView = LazyView(GetInTouchView(url: getInTouchUrl))
NavigationLink(destination: getInTouchView) {
     Text(NSLocalizedString("Get in touch", comment: "Get in touch"))
         .mp_white_outline_pill_button()
}

On iOS 14, the navigation bar is never visible. There also seems to be an issue where having two navigation links causes the get in touch view to pop immediately, so I include this under the above navigation link which seems to fix that issue:

NavigationLink(destination: EmptyView()) { EmptyView() }

However, the navigation bar is still never visible. The above code works fine on iOS 15, so this appears to be an issue with just iOS 14.

iOS 14:

enter image description here

iOS 15:

enter image description here

Simon
  • 1,354
  • 1
  • 14
  • 18

0 Answers0