【发布时间】:2021-08-31 12:20:10
【问题描述】:
我是 RXSwift 的新手,在我的应用程序中,我使用 Google Places Service 来获取 Place 坐标,然后我必须通过 get 请求访问我的 API,以检查获取的坐标是否在我们的操作区域内,我如何才能平面映射两者请求?
这是我的代码:
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
progress.startAnimating()
GMSPlacesClient.shared().lookUpPlaceID(placesArray[indexPath.row].placeID) { (place, error) in
//check if place is within the bounds array
if error == nil {
if checkPlace(place: place!){
// valid location
}else{
// un valid location
}
self.progress.stopAnimating()
}
print(place?.coordinate.latitude)
}
}
}
func checkPlace(place : GMSPlace)->Bool{
// Hit the api with get request
}
任何帮助将不胜感激
【问题讨论】: