0

I'm building an iOS framework that provides certain UI components for various consuming apps. In one of the UI components, I'm presenting a bottom sheet with a NavigationView overlaid with a ZStack for color.

In my test app, everything looks correct. The content of the NavigationView sits just below the navigation toolbar/title as expected.

But, when I install the framework into a production app, the content ends up underneath the NavigationView toolbar/title area.

I think I've narrowed it down to a problem with the SafeAreaInsets, but I'm not sure how to solve it. It seems like some default is overriding what I expected.

Any tips on how to solve this?

Here's my code:

import Foundation
import SwiftUI

struct MyView : View {
    var body: some View {
        NavigationView {
            ZStack {
                Color(UIColor(.blue)).edgesIgnoringSafeArea(.all)
                HStack(alignment: .top) {
                    VStack(alignment: .leading) {
                        Text("Your encryption key is already saved to your iCloud keychain. To view your key or transfer it to another device, tap below.")
                                .fixedSize(horizontal: false, vertical: true)
                    }
                }
            }
        }
    }
}

Here's the correct display:

enter image description here

And what I see for insets on this one:

enter image description here

Here's the incorrect display:

enter image description here

And the safe area insets on the incorrect one:

enter image description here

Matt Hamann
  • 1,488
  • 12
  • 24

0 Answers0