<file_sep>//
//  ViewController.swift
//  Melp
//
//  Created by <NAME> on 9/5/15.
//  Copyright (c) 2015 <NAME>. All rights reserved.
//

import UIKit
import GoogleMaps

class ViewController: UIViewController, CLLocationManagerDelegate {
    var locationManager: CLLocationManager = CLLocationManager()
    
    
    override func viewDidLoad() {
        super.viewDidLoad()
        var camera = GMSCameraPosition.cameraWithLatitude(-33.868,
            longitude:151.2086, zoom:6)
        var mapView = GMSMapView.mapWithFrame(CGRectZero, camera:camera)
        var marker = GMSMarker()
        marker.position = camera.target
        marker.snippet = "Hello World"
        marker.appearAnimation = kGMSMarkerAnimationPop
        marker.map = mapView
        
        self.view = mapView
        
        //figure out location
        
        locationManager.delegate = self
        locationManager.desiredAccuracy = kCLLocationAccuracyBest
        locationManager.requestWhenInUseAuthorization()
        locationManager.startUpdatingLocation()
        
    }
    
    func locationManager(manager: CLLocationManager!, didUpdateLocations locations: [AnyObject]!) {
        var latestLocation: AnyObject = locations[locations.count - 1]
        
        var latitude = NSString(format: "%.4f",
            latestLocation.coordinate.latitude).doubleValue
        var longitude = NSString(format: "%.4f",
            latestLocation.coordinate.longitude).doubleValue
        println(latitude)
        println(longitude)
        
        var camera = GMSCameraPosition.cameraWithLatitude(latitude,
                longitude:longitude, zoom:13)
        var mapView = GMSMapView.mapWithFrame(CGRectZero, camera:camera)
        var marker = GMSMarker()
        marker.position = camera.target
        marker.snippet = "Hello World"
        marker.appearAnimation = kGMSMarkerAnimationPop
        marker.map = mapView
        
        self.view = mapView
        locationManager.stopUpdatingLocation()
        
    }
    
    func locationManager(manager: CLLocationManager!, didFailWithError error: NSError!) {
        println("Error while updating location " + error.localizedDescription)
    }
}
<file_sep># Uncomment this line to define a global platform for your project
# platform :ios, '6.0'
platform :ios, '8.0'
use_frameworks!

target 'Melp' do
pod 'GoogleMaps'
pod 'OAuthSwift'
end

target 'MelpTests' do

end

