Skip to content

Instantly share code, notes, and snippets.

@ts95
Created July 19, 2020 00:21
Show Gist options
  • Save ts95/3417ef06192fd3128d486b0f9e9daf91 to your computer and use it in GitHub Desktop.
Save ts95/3417ef06192fd3128d486b0f9e9daf91 to your computer and use it in GitHub Desktop.
import SwiftUI
import MapKit
extension Map {
init<Items>(
coordinateRegion: Binding<MKCoordinateRegion>,
interactionModes: MapInteractionModes = .all,
showsUserLocation: Bool = false,
userTrackingMode: Binding<MapUserTrackingMode>? = nil,
annotationItems: Items
) where Content == _DefaultAnnotatedMapContent<Items>,
Items: RandomAccessCollection,
Items.Element == AnyMapAnnotationItem
{
self.init(
coordinateRegion: coordinateRegion,
interactionModes: interactionModes,
showsUserLocation: showsUserLocation,
userTrackingMode: userTrackingMode,
annotationItems: annotationItems,
annotationContent: { $0.annotation }
)
}
init<Items>(
mapRect: Binding<MKMapRect>,
interactionModes: MapInteractionModes = .all,
showsUserLocation: Bool = false,
userTrackingMode: Binding<MapUserTrackingMode>? = nil,
annotationItems: Items
) where Content == _DefaultAnnotatedMapContent<Items>,
Items: RandomAccessCollection,
Items.Element == AnyMapAnnotationItem
{
self.init(
mapRect: mapRect,
interactionModes: interactionModes,
showsUserLocation: showsUserLocation,
userTrackingMode: userTrackingMode,
annotationItems: annotationItems,
annotationContent: { $0.annotation }
)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment