Skip to content

Instantly share code, notes, and snippets.

@jeslyvarghese
Last active July 25, 2020 11:14
Show Gist options
  • Save jeslyvarghese/662444ebbf4d23027f441c4e573014b7 to your computer and use it in GitHub Desktop.
Save jeslyvarghese/662444ebbf4d23027f441c4e573014b7 to your computer and use it in GitHub Desktop.
let coordinates = CLLocationCoordinate2D(latitude: 37.3319, longitude: -122.0307812)
let snapShotOptions = MKMapSnapshotter.Options.init()
snapShotOptions.size = CGSize(width: 100, height: 100)
snapShotOptions.mapType = .satelliteFlyover
let span = MKCoordinateSpan(latitudeDelta: 0.05, longitudeDelta: 0.05)
snapShotOptions.region = MKCoordinateRegion(center: coordinates, span: span)
let snapShotter = MKMapSnapshotter(options: snapShotOptions)
snapShotter.start(with: .main) { (snapshot, error) in
self.mapImage = snapshot?.image
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment