i have distance in a variable of type CLLocationDistance i need to convert it in a integer variable how can i do it
i have use
CLLocationDistance kil
SWIFT 4
Late to this party, but you can also create an extension like this:
CLLocationDistance.swift
import UIKit
import CoreLocation
extension CLLocationDistance {
func inMiles() -> CLLocationDistance {
return self*0.00062137
}
func inKilometers() -> CLLocationDistance {
return self/1000
}
}
You could call it as follow:
distance.inKilometers()
I hope this helps anyone stumbling on this!