MKPointAnnotations的Swift Offset用于不同高度范围的相同位置坐标

我之前遇到过一个问题, 这里已经回答了 。 此外,我还有一个问题,我尝试了一种方法,但失败了。

我需要在地图上显示两个注释,它们具有相同的位置坐标。 数据来自于一项服务,我应用了一个逻辑来为相同纬度的位置增加一个0.0001的偏移量。 ( SO答案 )

现在,当我放大/缩小时,我正在使用计算高度

let updatedRadius = (mapView.camera.altitude)/1000 //in KM 

然后,我有以下保持注释之间的不断偏移(我的意思是,注释在任何缩放级别并排显示)

 switch updatedRadius { case 0 ... 5: allStoresInfo.map { currentStore in allStoresInfo.filter{$0.latLng![0] == currentStore.latLng![0]}.enumerated().forEach{ index, matchingStore in matchingStore.latLng![0] += Double(index)*0.0001 } } case 5 ... 10: allStoresInfo.map { currentStore in allStoresInfo.filter{$0.latLng![0] == currentStore.latLng![0]}.enumerated().forEach{ index, matchingStore in matchingStore.latLng![0] += Double(index)*0.001 } } case 10 ... 25: allStoresInfo.map { currentStore in allStoresInfo.filter{$0.latLng![0] == currentStore.latLng![0]}.enumerated().forEach{ index, matchingStore in matchingStore.latLng![0] += Double(index)*0.01 } } default: allStoresInfo.map { currentStore in allStoresInfo.filter{$0.latLng![0] == currentStore.latLng![0]}.enumerated().forEach{ index, matchingStore in matchingStore.latLng![0] += Double(index)*0.0001 } } } 

虽然这个代码有效,但它总是只应用0.0001偏移量。 为什么总是应用0.0001? 需要一些帮助,请:-)