从数组中删除 formattedCoordinate 的适当命令是什么?我知道 Objective-C 存在 removeObject,但是 Swift 呢?
var markersArray: Array<CLLocationCoordinate2D> = []
func mapView(_ mapView: GMSMapView, didTap marker: GMSMarker){
let lat: CLLocationDegrees = marker.position.latitude
let lng: CLLocationDegrees = marker.position.longitude
var formattedCoordinate = CLLocationCoordinate2D(latitude: lat,longitude: lng)
//markersArray.remove(formattedCoordinate) need to fix this
self.clean()
// return 0; not sure if we need this here
}
func mapView(_ mapView: GMSMapView, didBeginDragging marker: GMSMarker){
let lat: CLLocationDegrees = marker.position.latitude
let lng: CLLocationDegrees = marker.position.longitude
var formattedCoordinate = CLLocationCoordinate2D(latitude: lat,longitude: lng)
// markersArray.remove(formattedCoordinate) need to fix this
}