SwiftKickMobile/SwiftMessages

SwiftUI View ignoresSafeArea

Closed this issue · 4 comments

For the bottom card most time need ignoresSafeArea, maybe a config for ignoresSafeArea?

Could you provide a screenshot + code that demonstrates the issue you're having?

1
Just the SwiftUI demo project.

I'm assuming you want the background to extend to the edge of the screen, but you don't want your content within the safe area. You can do that with a mask. For example, I've modified the demo app to use a mask that rounds the bottom corners and ignores the top safe area:

var body: some View {
    VStack(alignment: .leading) {
        Text(message.title).font(.system(size: 20, weight: .bold))
        Text(message.body)
    }
    .multilineTextAlignment(.leading)
    .padding(30)
    .frame(maxWidth: .infinity)
    .background(.demoMessageBackground)
    .mask(
        UnevenRoundedRectangle(
            cornerRadii: .init(bottomLeading: 15, bottomTrailing: 15)
        )
        .edgesIgnoringSafeArea(.top)
    )
}

This produces the result below. Putting your content in the safe area would require overriding the safe area insets of MessageHostingView, which isn't currently supported. However, I'm adding something to make edge styling easier and may add support for that as well.

Does this resolve your issue?

image

Great, Thank you so much.