Moving the position of the search UI with .searchable modifier

Hi! I’m building a sheet UI similar to the sheet in Maps and Stocks that is overlayed over the main screen and can be dragged up and down with a gesture. I'm using .offset(x: 0, y: verticalOffset) on the entire sheet view.

I have a search bar in the sheet and attempted to replace it with the .searchable modifier. However, the search view appears in a fixed position near the top of the screen (about where it would be in a NavigationView) and does not move with the offset. It would be great if I could have it move with the sheet.

Thank you!

Code:

@State private var filter: String = ""

VStack {
        Grid()
}
        .background(.regularMaterial)

        .clipShape(RoundedRectangle(cornerRadius: 25, style: .continuous))

        .padding(.top, 100)

        .animation(.default, value: 5)

        .shadow(radius: 8)

        .edgesIgnoringSafeArea(.bottom)

        .searchable(text: $filter, placement: .automatic)

        .offset(x: 0, y: offset)
Moving the position of the search UI with .searchable modifier
 
 
Q