 public class ImageViewSpace : NSObject, UICoordinateSpace {
     var imageView : UIImageView
 
-    init(view v: UIImageView) {
-        imageView = v
+    init(view: UIImageView) {
+        imageView = view
         super.init()
     }
 

    }

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

    public func convertRect(imageRect: CGRect, toCoordinateSpace coordinateSpace: UICoordinateSpace) -> CGRect {
        let imageBottomRight = CGPoint(x: CGRectGetMaxX(imageRect), y: CGRectGetMaxY(imageRect))

        let viewTopLeft     = imageToViewPoint(imageRect.origin)
        let viewBottomRight = imageToViewPoint(imageBottomRight)

        let viewRectSize = CGSizeMake(abs(viewBottomRight.x - viewTopLeft.x), abs(viewBottomRight.y - viewTopLeft.y))
        let viewRect = CGRect(origin: viewTopLeft, size: viewRectSize)
        return imageView.convertRect(viewRect, toCoordinateSpace: coordinateSpace)
    }

    public func convertRect(rect: CGRect, fromCoordinateSpace coordinateSpace: UICoordinateSpace) -> CGRect {
        let viewRect = imageView.convertRect(rect, fromCoordinateSpace: coordinateSpace)
        let viewBottomRight = CGPoint(x: CGRectGetMaxX(viewRect), y: CGRectGetMaxY(viewRect))

        let imageTopLeft     = viewToImagePoint(viewRect.origin)
        let imageBottomRight = viewToImagePoint(viewBottomRight)

        let imageRectSize = CGSizeMake(abs(imageBottomRight.x - imageTopLeft.x), abs(imageBottomRight.y - imageTopLeft.y))
        let imageRect = CGRect(origin: imageTopLeft, size: imageRectSize)
        return imageRect
    }
}


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