Apple определена getCenter()
в расширении MKMapRect
:
extension MKMapRect {
/**
- returns: The point at the center of the rectangle.
- parameter rect: A rectangle.
*/
func getCenter() -> MKMapPoint {
return MKMapPointMake(MKMapRectGetMidX(self), MKMapRectGetMidY(self))
// now return MKMapPoint(x: self.midX, y: self.midY)
}
}
Поскольку getCenter()
возвращает MKMapPoint
, вам просто нужно получить доступ к его свойству coordinate
:
coordinate = boundingMapRect.getCenter().coordinate