How to launch Google Maps or Apple Maps from an iOS app with Swift

  1. 2 years ago
    Edited 2 years ago by niutech

    I need a sample code how to launch Google Maps or Apple Maps with Swift

    thx

  2. I want someting like this in swift language:
    http://www.reigndesign.com/blog/how-to-launch-google-maps-or-apple-maps-from-an-ios-app/

  3. niutech

    22 Jan 2016 Administrator

    Here is a tutorial on using Google Maps SDK in Swift .

    Sanple Swift code:

    import UIKit
    import GoogleMaps
    
    class ViewController: UIViewController {
      override func viewDidLoad() {
        super.viewDidLoad()
        let camera = GMSCameraPosition.cameraWithLatitude(20.0,
            longitude:20.0, zoom:6)
        let mapView = GMSMapView.mapWithFrame(CGRectZero, camera:camera)
        let marker = GMSMarker()
        marker.position = camera.target
        marker.snippet = "Hello World"
        marker.appearAnimation = kGMSMarkerAnimationPop
        marker.map = mapView
        self.view = mapView
      }
    }

or Sign Up to reply!