so I have rendered a Mapbox Map using the UIViewRepresentable protocol and the following function:
func makeUIView(context: Context) -> MGLMapView {
let map = MGLMapView()
DispatchQueue.main.async {
map.styleURL = self.mapStyle
map.delegate = context.coordinator
map.showsUserLocation = true
map.attributionButtonPosition = .topLeft
map.logoViewPosition = .topLeft
map.logoViewMargins.y = 15
map.logoViewMargins.x = 95
map.logoViewMargins.x = 12
map.attributionButtonMargins.x = 100
map.attributionButtonMargins.y = 15
self.configure(map)
}
return map
}
The only problem is that because I am hardcoding the values for the y margin, the positioning is not ideal across multiple devices. I'd like to use a GeometryReader to access the safeAreaInsets and then make the y padding a function of that. Does anyone know how to do this?