Reputation: 5374
I need to save in my table two Placemarks. One for the location and one for the destination. What I'm doing now is that im creating a dictionary with all the details as below:
let location: [String: Any] = [
"coordinate": GeoPoint(latitude: item.location.coordinate.latitude , longitude: item.location.coordinate.longitude),
"name": item.location.name,
"isoCountryCode": item.location.isoCountryCode,
"country": item.location.country,
...etc
]
and then Im saving this to Firestore. Then Im parsing this to my Placemark model(not CLPlacemark).
Recently I was thinking if it better to save only the coordinates and then to use GeoCoder
geocoder.reverseGeocodeLocation(location, completionHandler: { (placemarks, error) in
to fetch the placemark.
So which is actually better?
Upvotes: 1
Views: 280
Reputation: 666
It's much better to save only the coordinates. That way if there's something like a location name change, the saved placemark won't become outdated.
Upvotes: 1