有人可以帮我将下面的Objective-C语句转换为Swift吗?

CLLocationDistance distance = [fromLocation distanceFromLocation:toLocation];

我知道做到这一点必须很简单。我是iOS编程的新手,我们将不胜感激。

谢谢! :-)

最佳答案

let distance = fromLocation.distanceFromLocation(toLocation)

新语法:
let distance = aLocation.distance(from: anotherLocation)

10-08 05:36