user2913669
user2913669

Reputation: 63

Covert CLLocation to PFGeoPoint with Swift

Is there an example of the swift implementation of the constructor +geoPointWithLocation?

https://parse.com/docs/ios/api/Classes/PFGeoPoint.html#//api/name/geoPointWithLocation:

current attempt:

    self.locationManager.delegate = self
    self.locationManager.desiredAccuracy = kCLLocationAccuracyBest
    self.locationManager.requestWhenInUseAuthorization()
    self.locationManager.startUpdatingLocation()

    var currentLoc = CLLocationManager()
    currentGeoPoint = PFGeoPoint(geoPointWithLocation(currentLoc))

Upvotes: 0

Views: 1029

Answers (1)

rickster
rickster

Reputation: 126167

I haven't used this framework, but... Try PFGeoPoint(location: currentLoc).

Generally, when you have an ObjC factory method call like +[NSFooBar fooBarWithBaz:], it imports as the Swift initializer init(baz:).

Oh, and it looks like you need to actually get a location from your CLLocationManager, not just pass the manager to PFGeoPoint.

Upvotes: 2

Related Questions