Open dpelletier2017 opened 5 years ago
import SwiftUI
import MapKit
struct MapView: UIViewRepresentable {
let manager: ClusterManager
func makeUIView(context: Context) -> MKMapView {
MKMapView(frame: .zero)
}
func updateUIView(_ view: MKMapView, context: Context) {
view.delegate = self
}
}
extension MapView: MKMapViewDelegate {
func mapView(_ mapView: MKMapView, viewFor annotation: MKAnnotation) -> MKAnnotationView? {
return SomeAnnotationView()
}
func mapView(_ mapView: MKMapView, regionDidChangeAnimated animated: Bool) {
manager.reload(mapView: mapView)
}
}
struct MapView_Preview: PreviewProvider {
static var previews: some View {
MapView()
}
}
More examples can be found on https://developer.apple.com/tutorials/swiftui/creating-and-combining-views
Can you send me a more comprehensive swiftui example? People who have never used storyboards like me may have difficulty with some connections.
shame on Apple still doesn't provide clustering for SwiftUI Map even in ios 17. I'm waiting for a step for this repo but it still has no SwiftUI support https://github.com/vospennikov/ClusterMap
@emrdgrmnci Apple will, on next WWDC, say to us "The wonderful feature of clustering, iOS 18 minimum 🤡", so, clustering libraries has 3/5 of life I think.
Hi, Would it be possible to add a SwiftUI Example of how to incorporate Cluster into a project in SwiftUI project in Xcode 11? Thanks a lot!