I upload the user's longitude and lattiude to firebase under two seperate key value pairs and then on the mapView I take a snapshot and obtain the longitude and the lattiude. I had to store them as strings, but I change them to doubles and store them in a 2D array of doubles. I then need to store it in a CLLocationCoordinate2D array. Then after that I need to plot those on the MapView. I am getting stuck on how to turn them into the CLLocationCoordinate2D array and then ploting those locations so that they all show up on the map.
My 2D array looks like this: bookLoc[[121.09900,56.5999],[123.94949, 45.0099]] //etc there are more points but I think this gets the point accoss.
I am not sure how to give CLLocationCoordinate2DMake given multiple coordinates. Thank you
Use map
:
let arr = [[121.09900,56.5999], [123.94949, 45.0099], [...] ]
let coordinates = arr.map { CLLocationCoordinate2D(latitude: $0[0], longitude: $0[1]) }