Created
July 18, 2020 23:42
-
-
Save ts95/3c0f04f36003c3f8f2213f29d80ce00f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
import MapKit | |
protocol MapAnnotationItem: Identifiable { | |
associatedtype Annotation: MapAnnotationProtocol | |
var coordinate: CLLocationCoordinate2D { get } | |
var annotation: Annotation { get } | |
} | |
struct AnyMapAnnotationItem: MapAnnotationItem { | |
let id: AnyHashable | |
let coordinate: CLLocationCoordinate2D | |
let annotation: AnyMapAnnotation | |
let base: Any | |
init<T: MapAnnotationItem>(_ base: T) { | |
self.id = base.id | |
self.coordinate = base.coordinate | |
self.annotation = AnyMapAnnotation(base.annotation) | |
self.base = base | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment