Mapbox iOS - 在版本 10 上找不到类似于 "visibleFeatures" 的功能

Mapbox iOS - Cannot find the function similar to "visibleFeatures" on version 10

我正在将 Mapbox 从 3.6 版本迁移到 10.0 版本 现在我面临的问题是,在旧版本中,当用户点击地图时,我使用“visibleFeatures”函数来获取 MGLFeature。

@objc func handleTapWithGestureRecognizer(_ tapGestureRecognizer: UITapGestureRecognizer) {
let point = tapGestureRecognizer.location(in: mapBoxView)
let target = mapBoxView.visibleFeatures(at: point, styleLayerIdentifiers: ["layer01", "layer02"], predicate: NSPredicate(format: "%K != '' AND offset >= 0 ","local_path"))
...

}

但是在10.0版本中,我找不到任何类似于“visibleFeatures”的功能。 任何人请帮助

谢谢大家!

试试这个:

// Query rendered features at point
mapView.mapboxMap.queryRenderedFeatures(at: point, options: nil, completion: { [weak self] result in
      switch result {
      case .success(let features):
            // Do something with the features
      case .failure(let error):
            print(error.localizedDescription)
      }
})