دنبال کننده ها

۱۳۹۷ فروردین ۲۱, سه‌شنبه

swift - Xcode Google Maps Marker from Json

[ad_1]



Im trying to add markers from latitude and longitude from a json file. In my ViewController i have parsed the json information and i have my lat and long in double arrays.



But the code dont work, i cant add any marker.



Does anyone know what i do wrong?



func initGoogleMaps() {

let camera = GMSCameraPosition.camera(withLatitude: 56.879004, longitude: 14.805852, zoom: 13)
let mapView = GMSMapView.map(withFrame: CGRect.zero, camera: camera)
mapView.isMyLocationEnabled = true

do {

self.googleMapsView.camera = camera

let marker1 = GMSMarker()
marker1.position = CLLocationCoordinate2DMake(latString, lngString)
marker1.title = "Hello"
marker1.snippet = "City"
marker1.icon = UIImage(named: "map-marker")
marker1.map = googleMapsView



[ad_2]

لینک منبع