Hello,
I have successfully used the getCoordinates() function provided by Apple Documentation to convert an address to coordinates. I created my own struct for a Pin that includes name, latitude, and longitude as properties.
I am able to add Markers to my map using these three properties. My problem is that I'd like to use these Markers to pull up further information, such as lookaround views. To use these API call functions, I need to provide an MKMapItem as an argument to the mapItem parameter.
MKLookAroundSceneRequest(mapItem: MKMapItem)
I'm having trouble using the MKMapItem documentation to understand how to make my own MKMapItems.
If I try using the autocomplete in XCode, I can get this:
MKMapItem(placemark: MKPlacemark(coordinate: CLLocationCoordinate2D(latitude: latitude, longitude: longitude)))
Is it possible to add a name when instantiating a new MKMapItem? From the documentation, it seems like name is a property of MKPlacemark, but I can't get this to work.
Should I alter the getCoordinates() function to return the entire placemark instead of just the coordinates?
Any guidance would be much appreciated! Thanks!