Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CLLocationDegrees to String variable in Swift

Given that the code

var latitude = userLocation.coordinate.latitude

returns a CLLocationDegrees Object, how can I store the value in to a variable so that I can apply it as the text of a label.

I can print the variable to the console without any issues but obviously that doesn't help me too much!

Looking through the valuable options through the autocomplete i see there is a description;

var latitude = userLocation.coordinate.latitude.description

But this is returning me null?

Thanks

like image 348
Biscuit128 Avatar asked Oct 01 '14 13:10

Biscuit128


1 Answers

since CLLocationDegrees is just a typedef for Double, you can easily assign it to a string var, ie:

var latitudeText:String = "\(userLocation.coordinate.latitude)"
like image 153
hedzs Avatar answered Oct 02 '22 14:10

hedzs