2 Replies
      Latest reply on Nov 20, 2019 7:39 AM by MISTERCEC
      MISTERCEC Level 1 Level 1 (0 points)

        Hi, I'm trying to change the pin color of my mapView, is it possible?

        This is my code for now

        import SwiftUI
        import MapKit
        
        struct MapView: UIViewRepresentable {
        
            func makeUIView(context: Context) -> MKMapView {
                MKMapView(frame: .zero)
            }
        
            func updateUIView(_ view: MKMapView, context: Context) {
                let coordinate = CLLocationCoordinate2D(latitude: 41.928725, longitude: 12.466310)
                let span = MKCoordinateSpan(latitudeDelta: 0.0075, longitudeDelta: 0.0075)
                let region = MKCoordinateRegion(center: coordinate, span: span)
                view.setRegion(region, animated: true)
                
                let annotation = MKPointAnnotation()
        
                annotation.coordinate = coordinate
                annotation.title = "Visit us soon"
                
                view.addAnnotation(annotation)
            }
        }
        
        struct MapView_Previews: PreviewProvider {
            static var previews: some View {
                MapView()
            }
        }