     func imageCoordinatedSpace() -> UICoordinateSpace {
         return ImageViewSpace(view: self)
     }
-}+}

public class ImageViewSpace : NSObject, UICoordinateSpace {
    var imageView : UIImageView

    init(view v: UIImageView) {
        imageView = v
        super.init()
    }


    }

    public func convertPoint(point: CGPoint, fromCoordinateSpace coordinateSpace: UICoordinateSpace) -> CGPoint {
        return viewToImagePoint(imageView.convertPoint(point, fromCoordinateSpace: coordinateSpace))
    }

    private func convertRect(rect:CGRect, usingConvertPoint:((CGPoint) -> CGPoint)) -> CGRect {
        let rectBottomRight = CGPoint(x: CGRectGetMaxX(rect), y: CGRectGetMaxY(rect))

        let convertedTopLeft     = usingConvertPoint(rect.origin)
        let convertedBottomRight = usingConvertPoint(rectBottomRight)

        let convertedRectSize = CGSizeMake(abs(convertedBottomRight.x - convertedTopLeft.x), abs(convertedBottomRight.y - convertedTopLeft.y))
        return CGRect(origin: convertedTopLeft, size: convertedRectSize)
    }

    public func convertRect(imageRect: CGRect, toCoordinateSpace coordinateSpace: UICoordinateSpace) -> CGRect {
        return imageView.convertRect(convertRect(imageRect, usingConvertPoint: imageToViewPoint), toCoordinateSpace: coordinateSpace)
    }

    public func convertRect(rect: CGRect, fromCoordinateSpace coordinateSpace: UICoordinateSpace) -> CGRect {
        return convertRect(imageView.convertRect(rect, fromCoordinateSpace: coordinateSpace), usingConvertPoint:viewToImagePoint)
    }
}

