Brian, I used GeometryReader instead of the UIApplication to get the safeAreaInsets.top
struct DirectionsSearchView: View {
var body: some View {
GeometryReader { geometry in
ZStack(alignment: .top) {
VStack(spacing: 0) {
VStack {
Spacer()
.frame(height: geometry.safeAreaInsets.top)
HStack(spacing: 16) {
Image(uiImage: #imageLiteral(resourceName: "start_location_circles"))
HStack {
Text("Source")
Spacer()
}
.padding()
.background(Color.white)
.cornerRadius(3)
}
HStack(spacing: 16) {
Image(uiImage: #imageLiteral(resourceName: "annotation_icon").withRenderingMode(.alwaysTemplate))
.foregroundColor(.white)
HStack {
Text("Destination")
Spacer()
}
.padding()
.background(Color.white)
.cornerRadius(3)
}
}
.padding()
.background(Color.blue)
DirectionsMapView()
.edgesIgnoringSafeArea(.bottom)
}.edgesIgnoringSafeArea(.top)
}
}
}
}