Number:rdar://46479285 Date Originated:05-Dec-2018 08:57 AM
Status:Open Resolved:
Product:iOS + SDK Product Version:12.1
Classification:Enhancement Reproducible:Always
This is a duplicate of radar #46453267

Some API would be nice if it was updated to support UICoordinateSpace. This is a newer protocol that can be used for more general coordinate space conversions than just between views.

For example, at PSPDFKit we make a framework with API for working with PDF documents, and we expose a page’s PDF coordinate space on our view that displays a PDF page. The PDF coordinate system has a different origin and scale to the view. UICoordinateSpace is a nice API for us.

Currently it is necessary to get a touch point in a view coordinate space then convert to PDF coordinate space, like this:

let viewPoint = touch.location(in: pageView)
let pdfPoint = pageView.convert(viewPoint, to: pageView.pdfCoordinateSpace)

It would be nice to be able to replace that with a single line:

let pdfPoint = touch.location(in: pageView.pdfCoordinateSpace)

The following API currently require a view:

-[UITouch locationInView:]
-[UITouch preciseLocationInView:]
-[UIGestureRecognizer locationInView:]

These could have preferred alternatives like this:

-[UITouch locationInCoordinateSpace:]
-[UITouch preciseLocationInCoordinateSpace:]
-[UIGestureRecognizer locationInCoordinateSpace:]

As we saw above in Swift the call looks the same — just location(in: whatever). It’s more lenient in the types of things it accepts which is cool.

Steps to Reproduce:
Look for API to get the location of a touch or gesture recogniser in a coordinate space other than a view.

Expected Results:
API as discussed above to exist.

Actual Results:
No such API. We must get the touch location in an intermediate coordinate space.




Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!