Я создал расширение для MKMapView
Swift 4.2
extension MKMapView {
func topLeftCoordinate() -> CLLocationCoordinate2D {
return convert(.zero, toCoordinateFrom: self)
}
func bottomRightCoordinate() -> CLLocationCoordinate2D {
return convert(CGPoint(x: frame.width, y: frame.height), toCoordinateFrom: self)
}
}
Swift 2.0
extension MKMapView {
func topLeftCoordinate() -> CLLocationCoordinate2D {
return convertPoint(CGPoint.zero, toCoordinateFromView: self)
}
func bottomRightCoordinate() -> CLLocationCoordinate2D {
return convertPoint(CGPoint(x: frame.width, y: frame.height), toCoordinateFromView: self)
}
}