Need help creating a bottom sheet and safe area with swiftUI

I'm trying to create a bottom sheet in swift ui that looks something like this

https://user-images.githubusercontent.com/33900517/172068237-4dd58374-b6e6-4340-a913-7085fb64b254.mp4

My issue is that I have an animated bottom sheet, but because it is ignoring the safe area, when I click into the textfield it does not expand with the keyboard.

How would I fix this so the view expands with the keyboard but the white at the bottom still goes beyond the safe area?

I.e. the containing view should ignore the safe area, and the content within should adhere to the safe area.

Here is the bottom sheet code

   var body: some View {
    GeometryReader { geometry in
      VStack() {
        self.content
      }
      .padding(.vertical, 34)
      .padding(.horizontal, 16)
//      .frame(width: geometry.size.width, height: geometry.size.height * heightRatio, alignment: .top)
      .frame(width: geometry.size.width, height: self.maxHeight, alignment: .top)
      .background(Color(.white))
      .cornerRadius(Constants.radius)
      .frame(height: geometry.size.height, alignment: .bottom)
      .offset(y: max(self.offset + self.translation, 0))
      .animation(.interactiveSpring())
      .gesture(
          DragGesture().updating(self.$translation) { value, state, _ in
                state = value.translation.height
              }.onEnded { value in
                let snapDistance = self.maxHeight * Constants.snapRatio
                guard abs(value.translation.height) > snapDistance else {
                  return
                }
                self.isOpen = value.translation.height < 0
              }
      )
    }
    .edgesIgnoringSafeArea([.bottom, .horizontal])
    .shadow(color: Color(hue: 1.0, saturation: 0.0, brightness: 0.0, opacity: 0.08), radius: 12, y: -8)
  }

Bottom sheet is closed

Bottom sheet open

Bottom sheet open and textfield is selected, keyboard is active

Answered by CTOverton in 716589022

These forums were being a bit slow for me, I got the answer on StackOverflow. Hope this helps anyone in the future!

https://stackoverflow.com/questions/72525526/how-to-ignore-safe-area-for-container-and-respect-safe-area-for-content-in-swift

Accepted Answer

These forums were being a bit slow for me, I got the answer on StackOverflow. Hope this helps anyone in the future!

https://stackoverflow.com/questions/72525526/how-to-ignore-safe-area-for-container-and-respect-safe-area-for-content-in-swift

Need help creating a bottom sheet and safe area with swiftUI
 
 
Q