suman4b2
suman4b2

Reputation: 1

Why I am getting an error as use of unresolved identifier 'CLLocationCoordinate2D'?

I am using this code in my project.I have imported UIKit and GoogleMaps, but I am getting an error as "use of unresolved identifier CLLocationCoordinate2D". please help me in solving this issue

class ViewController: UIViewController {

override func viewDidLoad() {
    super.viewDidLoad()
  let camera = GMSCameraPosition.camera(withLatitude: -33.86, longitude: 151.20, zoom: 6.0)
let mapView = GMSMapView.map(withFrame: CGRect.zero, camera: camera)
    let view = mapView

    // Creates a marker in the center of the map.
    let marker = GMSMarker()
    marker.position = CLLocationCoordinate2D(latitude: -33.86, longitude: 151.20)
    marker.title = "Sydney"
    marker.snippet = "Australia"
    marker.map = mapView
}

}

Upvotes: 0

Views: 1106

Answers (2)

Anand Nimje
Anand Nimje

Reputation: 6251

For accessing CLLocationCoordinate2D you must need to import CoreLocation inside your file then you can able to access all CoreLocation framework features.

Upvotes: 0

Nirav D
Nirav D

Reputation: 72410

You need to import the CoreLocation framework for that.

import CoreLocation

Upvotes: 2

Related Questions