If I am using: ```NavigationView { Mai...
# compose-ios
j
If I am using:
Copy code
NavigationView {
            MainScreen()
            .navigationViewStyle(StackNavigationViewStyle())
            .edgesIgnoringSafeArea(.all)
        }
Is it possible to propagate the insets back to compose somehow? In this case top and bottom nav bar from NavigationView.
d
j
@Dima Avdeev Thanks, and how do I do this myself until its released? 🙂 Didnt find it in the code in that pull?
It looks like I should do something like:
Copy code
MainScreen()
                .environment(EnvironmentValues.safeAreaInsets, UIApplication.shared.windows.first?.safeAreaInsets)
But not sure how to apply it to be honest in Swift 😄
d
Ok, sorry. It is impossible to apply our Compose Insets on Swift side.
I am doing it only for Kotlin inside Compos usage
j
Not impossible, but trying to do something like this myself for the moment to get around the issue:
Copy code
NavigationView {
            MainScreen()
            .navigationViewStyle(StackNavigationViewStyle())
            .navigationBarHidden(true)
            .frame(maxWidth: .infinity, maxHeight: .infinity)
            .edgesIgnoringSafeArea([.top, .bottom])
        }
Sovled it by doing it like this:
Copy code
NavigationView {
            MainScreen()
            .navigationViewStyle(StackNavigationViewStyle())
        }                        .frame(maxWidth: .infinity, maxHeight: .infinity)
                                 .edgesIgnoringSafeArea([.top, .bottom])
                     .ignoresSafeArea(.container, edges: .top)
                     .ignoresSafeArea(.container, edges: .bottom)
Needed to apply it on NavigationView, not the content inside it 😄
Sure I cant apply the insets into top bar och bottom navigation as padding, but at least nothing covered.