diff --git a/Sources/Site/Music/UI/LocatableMap.swift b/Sources/Site/Music/UI/LocatableMap.swift index 02803269..c7a3de55 100644 --- a/Sources/Site/Music/UI/LocatableMap.swift +++ b/Sources/Site/Music/UI/LocatableMap.swift @@ -9,13 +9,13 @@ import MapKit import SwiftUI struct LocatableMap: View where T: Locatable, T: Equatable { - let locations: [T] + let location: T var body: some View { Map( - mapRect: .constant(locations.paddedRect), + mapRect: .constant(location.paddedRect), interactionModes: MapInteractionModes(), - annotationItems: locations + annotationItems: [location] ) { item in MapMarker(coordinate: item.center) } @@ -31,5 +31,5 @@ struct LocatableMap: View where T: Locatable, T: Equatable { var radius: CLLocationDistance { 100.0 } } - return LocatableMap(locations: [PreviewLocation()]) + return LocatableMap(location: PreviewLocation()) } diff --git a/Sources/Site/Music/UI/LocationMap.swift b/Sources/Site/Music/UI/LocationMap.swift index fe74691b..076efe4f 100644 --- a/Sources/Site/Music/UI/LocationMap.swift +++ b/Sources/Site/Music/UI/LocationMap.swift @@ -17,7 +17,7 @@ struct LocationMap: View { var body: some View { ZStack { if let placemark { - LocatableMap(locations: [placemark]) + LocatableMap(location: placemark) .onTapGesture { MKMapItem(placemark: MKPlacemark(placemark: placemark)).openInMaps() } diff --git a/Sources/Site/Utility/Locatable.swift b/Sources/Site/Utility/Locatable.swift index 9c8be5e6..d7673cb1 100644 --- a/Sources/Site/Utility/Locatable.swift +++ b/Sources/Site/Utility/Locatable.swift @@ -27,14 +27,6 @@ extension Locatable { return MKMapRect(origin: MKMapPoint(center), size: MKMapSize(width: 1, height: 1)).insetBy( dx: -mapPointOffset, dy: -mapPointOffset) } -} - -extension Sequence where Element: Locatable { - var rect: MKMapRect { - var union = MKMapRect.null - self.forEach { union = union.union($0.rect) } - return union - } var paddedRect: MKMapRect { let locatableRect = self.rect