Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to convert Latitude and longitude to float value in swift

I have tried the below code : but it shows error cannot convert value of type float to expected argument type CLLocation degrees(aka Double)

    let lat = self.mallData.valueForKey("lat") as! Float
    let lon = self.mallData.valueForKey("lon")



    let mapLocation : CLLocationCoordinate2D = CLLocationCoordinate2DMake(lat, lon)
like image 535
Rakesh Mohan Avatar asked Sep 27 '16 04:09

Rakesh Mohan


1 Answers

The CLLocationCoordinate2DMake supports Double values. But you are converting lat and lon to Float.

Try converting Lat and Lon to Double.

like image 165
Bista Avatar answered Nov 09 '22 17:11

Bista