如何将CLLocationCoordinate2D纬度和longtitute转换为double?

时间:2017-04-29 15:17:21

标签: google-maps swift3 cllocation

如何在Swift 3中将CLLocationCoordinate2D纬度和longtitute转换为Double

1 个答案:

答案 0 :(得分:1)

latitudelongitudeCLLocationCoordinate2D实例属性属于CLLocationDegreestypealiasDouble

所以你真的不需要做任何事情:

func printDouble(_ d: Double) { print(d) }

let coords = CLLocationCoordinate2D(latitude: 123.0, longitude: 456.0)
printDouble(coords.latitude) // Works just fine
printDouble(coords.longitude)