There ist a small error in "convertRect(fromViewRect viewRect : CGRect)"
let imageTopLeft = convertPoint(fromImagePoint: viewTopLeft) let imageBottomRight = convertPoint(fromImagePoint: viewBottomRight)
should be replaced with
let imageTopLeft = convertPoint(fromViewPoint: viewTopLeft) let imageBottomRight = convertPoint(fromViewPoint: viewBottomRight)
There ist a small error in "convertRect(fromViewRect viewRect : CGRect)"
let imageTopLeft = convertPoint(fromImagePoint: viewTopLeft) let imageBottomRight = convertPoint(fromImagePoint: viewBottomRight)should be replaced with
let imageTopLeft = convertPoint(fromViewPoint: viewTopLeft) let imageBottomRight = convertPoint(fromViewPoint: viewBottomRight)