SwiftUI Marker monogram replaces title inside List
Marker(_:monogram:coordinate:) renders incorrectly when the Map is embedded in a List.
Expected:
LDNinside the marker pinLondonbelow the pin
Actual inside List:
LDNappears in the title positionLondonis missing- The pin has no monogram
Screenshots
With List — incorrect rendering
Without List — expected rendering
With List
import SwiftUI
import MapKit
struct MapListView: View {
let position = CLLocationCoordinate2D(
latitude: 51.5074,
longitude: -0.1278
)
var body: some View {
List {
Map(
initialPosition: .region(
MKCoordinateRegion(
center: position,
span: .init(
latitudeDelta: 0.2,
longitudeDelta: 0.2
)
)
)
) {
Marker(
"London",
monogram: Text("LDN"),
coordinate: position
)
}
.frame(height: 260)
}
}
}
Without List
struct MapView: View {
let position = CLLocationCoordinate2D(
latitude: 51.5074,
longitude: -0.1278
)
var body: some View {
Map(
initialPosition: .region(
MKCoordinateRegion(
center: position,
span: .init(
latitudeDelta: 0.2,
longitudeDelta: 0.2
)
)
)
) {
Marker(
"London",
monogram: Text("LDN"),
coordinate: position
)
}
.frame(height: 260)
}
}
The marker renders correctly when the Map is not inside a List.
Is this a known SwiftUI or MapKit bug?