1

Hello I'm working on Mapbox I getting data from API and I am showing that data on the map but I want to show the default pointer to the image I'm getting from API can anybody help me

        for locationStruct in self.locations
    {
        
        let annotation = MGLPointAnnotation()
        
        annotation.coordinate = CLLocationCoordinate2D(latitude: Double(locationStruct.latitude) ?? 0.0, longitude: Double(locationStruct.longitude) ?? 0.0)
        annotation.title = locationStruct.name
        //Getting image
        let url = URL(string:"http://app.freewayfinder.com/assets/uploads/spots/\(locationStruct.img)")
        //Convert image in to data
        let data = (try? Data(contentsOf: url!))!
        
        
        self.mapview.addAnnotation(annotation)

    }

this is code where I'm showing pointer's in map

Aneeq Shah
  • 126
  • 3
  • 11

0 Answers0