Skip to content

Instantly share code, notes, and snippets.

@mmar
Last active December 29, 2020 22:38
Show Gist options
  • Save mmar/516defc4e22fe12edd7781ed23507f67 to your computer and use it in GitHub Desktop.
Save mmar/516defc4e22fe12edd7781ed23507f67 to your computer and use it in GitHub Desktop.
Geocoding in Xcode playgrounds
import MapKit
import PlaygroundSupport
let mapView = MKMapView()
PlaygroundPage.current.liveView = mapView
CLGeocoder().geocodeAddressString("1 Apple Park Way, Cupertino, CA") {
(places, _) in
guard let places = places?.map(MKPlacemark.init) else { return }
mapView.showAnnotations(places, animated: true)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment