import MapKit

extension MKMapRect {

    mutating func extend(by factor: Double) {
        let dx = self.width * (1 - factor) / 2
        let dy = height * (1 - factor) / 2
        self = insetBy(dx: dx, dy: dy)
    }

    func extended(by factor: Double) -> MKMapRect {
        let dx = self.width * (1 - factor) / 2
        let dy = height * (1 - factor) / 2
        return insetBy(dx: dx, dy: dy)
    }
}
