I finally ended up like that
If this can help
if previousLocation == nil {
previousLocation = locations.first
} else {
guard let latest = locations.first else { return }
let distanceInMeters = previousLocation?.distance(from: latest) ?? 0
var distanceRounded = distanceInMeters.rounded()
print("Distance in meters: (distanceRounded)")
let unwrappedPaceNumber = paceNumber[0]
distanceRounded += Double(unwrappedPaceNumber)!
paceNumber[0] = "(distanceRounded)"
print(paceNumber[0])
tableView.reloadData()
previousLocation = latest
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…