In order to setup a query to an external server I want to get the bounds of the current Map View in an iPhone app I\'m building. UIView should respond to bounds but it seems
Swift away... (Based on @deadroxy's answer...)
typealias Edges = (ne: CLLocationCoordinate2D, sw: CLLocationCoordinate2D)
extension MKMapView {
func edgePoints() -> Edges {
let nePoint = CGPoint(x: self.bounds.maxX, y: self.bounds.origin.y)
let swPoint = CGPoint(x: self.bounds.minX, y: self.bounds.maxY)
let neCoord = self.convert(nePoint, toCoordinateFrom: self)
let swCoord = self.convert(swPoint, toCoordinateFrom: self)
return (ne: neCoord, sw: swCoord)
}
}