import CoreLocation
import GoogleMaps
import UIKit

class ViewController: UIViewController, CLLocationManagerDelegate {
    var mapView: GMSMapView?
    var locationManager:CLLocationManager!
    let marker = GMSMarker()

    override func viewDidLoad() {
        super.viewDidLoad()

        mapView = GMSMapView()
        
        locationManager = CLLocationManager()

        locationManager.delegate = self
        locationManager.desiredAccuracy = kCLLocationAccuracyKilometer
        locationManager.distanceFilter = 50

        locationManager.requestWhenInUseAuthorization()
        locationManager.requestAlwaysAuthorization()
        locationManager.startUpdatingLocation()

        self.view = mapView
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
    }
    
    func locationManager(_ manager: CLLocationManager, didChangeAuthorization status: CLAuthorizationStatus) {
        if (status == CLAuthorizationStatus.authorizedWhenInUse) {
            mapView!.isMyLocationEnabled = true
        }
    }
    
    func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
        let newLocation: CLLocationCoordinate2D = (manager.location?.coordinate)!
        print(newLocation)
        
        mapView!.camera = GMSCameraPosition.camera(withLatitude: newLocation.latitude, longitude: newLocation.longitude, zoom: 16.0)
        mapView!.settings.myLocationButton = true
        self.view = self.mapView!
        
        
        marker.position = CLLocationCoordinate2DMake(newLocation.latitude, newLocation.longitude)
        marker.map = self.mapView!
    }
}


//
//  ViewController.swift
//  Trippie
//
//  Created by Ru Chern Chong on 20/6/17.
//  Copyright © 2017 Ru Chern Chong. All rights reserved.
//

import UIKit

class ViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view, typically from a nib.
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }


}


--- 
+++ 
@@ -1,25 +1,51 @@
-//
-//  ViewController.swift
-//  Trippie
-//
-//  Created by Ru Chern Chong on 20/6/17.
-//  Copyright © 2017 Ru Chern Chong. All rights reserved.
-//
-
+import CoreLocation
+import GoogleMaps
 import UIKit
 
-class ViewController: UIViewController {
+class ViewController: UIViewController, CLLocationManagerDelegate {
+    var mapView: GMSMapView?
+    var locationManager:CLLocationManager!
+    let marker = GMSMarker()
 
     override func viewDidLoad() {
         super.viewDidLoad()
-        // Do any additional setup after loading the view, typically from a nib.
+
+        mapView = GMSMapView()
+        
+        locationManager = CLLocationManager()
+
+        locationManager.delegate = self
+        locationManager.desiredAccuracy = kCLLocationAccuracyKilometer
+        locationManager.distanceFilter = 50
+
+        locationManager.requestWhenInUseAuthorization()
+        locationManager.requestAlwaysAuthorization()
+        locationManager.startUpdatingLocation()
+
+        self.view = mapView
     }
 
     override func didReceiveMemoryWarning() {
         super.didReceiveMemoryWarning()
-        // Dispose of any resources that can be recreated.
     }
-
-
+    
+    func locationManager(_ manager: CLLocationManager, didChangeAuthorization status: CLAuthorizationStatus) {
+        if (status == CLAuthorizationStatus.authorizedWhenInUse) {
+            mapView!.isMyLocationEnabled = true
+        }
+    }
+    
+    func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
+        let newLocation: CLLocationCoordinate2D = (manager.location?.coordinate)!
+        print(newLocation)
+        
+        mapView!.camera = GMSCameraPosition.camera(withLatitude: newLocation.latitude, longitude: newLocation.longitude, zoom: 16.0)
+        mapView!.settings.myLocationButton = true
+        self.view = self.mapView!
+        
+        
+        marker.position = CLLocationCoordinate2DMake(newLocation.latitude, newLocation.longitude)
+        marker.map = self.mapView!
+    }
 }
 
Add logic for getting locations

Signed-off-by: Ru Chern Chong <e992923f255d889b2c54992beb91fae866f76e47@sproud.biz>
