visionOS console warning: Trying to convert coordinates between views that are in different UIWindows

Hello,

I have an iOS app that is using SwiftUI but the gesture code is written using UIGestureRecognizer. When I run this app on visionOS using the "Designed for iPad" destination and try to use any of my gestures I see this warning in the console:

Trying to convert coordinates between views that are in different UIWindows, which isn't supported. Use convertPoint:fromCoordinateSpace: instead.

But I don't see any visible problems with the gestures.

I see this warning printed out after the gesture takes place but before any of our gesture methods get kicked off. So now I am wondering if this is something we need to deal with or some internal work that needs to happen in UIKit.

Does anyone have any thoughts on this?

Answered by Vision Pro Engineer in 796535022

Hey @klinee101,

Thanks for your question. This warning asks clients to use the convertPoint:fromCoordinateSpace: method rather than the convertPoint:fromView: method. If you are not using any methods in this family your code should be fine.

If you are able to reproduce this in a sample project, I'd greatly appreciate it if you could file a bug report via Feedback Assistant with the sample project, and post the FB number here once you do.

Bug Reporting: How and Why? has tips on creating your bug report.

Thanks!

Michael

Accepted Answer

Hey @klinee101,

Thanks for your question. This warning asks clients to use the convertPoint:fromCoordinateSpace: method rather than the convertPoint:fromView: method. If you are not using any methods in this family your code should be fine.

If you are able to reproduce this in a sample project, I'd greatly appreciate it if you could file a bug report via Feedback Assistant with the sample project, and post the FB number here once you do.

Bug Reporting: How and Why? has tips on creating your bug report.

Thanks!

Michael

Thanks for the response!

We aren't using any of those methods hence why I was confused.

Here is the reproducer.

  1. Create a basic visionOS app in Xcode.
  2. Place the ContentView in a NavigationView in the app file.
  3. Paste the code below in the ContentView
  4. When you run the app, press the "EmptyView" button. Click anywhere on the sidebar to see the warning appear in the console.

The ContentView code:

struct ContentView: View {
    var body: some View {
        List {
            NavigationLink("EmptyView") { EmptyView() }
                .isDetailLink(false)
        }
        .navigationTitle("Views")
        .navigationBarTitleDisplayMode(.large)
    }
}
visionOS console warning: Trying to convert coordinates between views that are in different UIWindows
 
 
Q