iOS app running in compatibility mode on Apple Vision Pro does not apply hoverEffect to SwiftUI View

We tested our iOS app on visionOS and found that the hover effect works on most of UIKit views, but it does not work on most of SwiftUI views.

SwiftUI views are used within UIHostingController.

I created a new project (Storyboard based iOS app) and displayed the following SwiftUI view in UIHostingController and found that the buttons in the List were highlighted, but not the standalone buttons.

struct SwiftUIView: View {

    var body: some View {
        List {
            // This button has the hover effect.
            Button {
                print("Hello")
            } label: {
                Text("Hello")
            }
        }

        // This button does't have the hover effect.
        Button {
            print("Hello")
        } label: {
            Text("Hello")
        }
        .hoverEffect()
    }

}

Is there a way to highlight any SwiftUI view?

Answered by Vision Pro Engineer in 792989022

In case anyone else runs into this - this is a known issue currently. Please submit a bug report at https://feedbackassistant.apple.com and post the FB number here so that you can track the resolution of it as well.

Hi @sion.jw ,

I ran this code in a new iOS project containing a UIHostingController with this view and saw the buttons highlighting correctly on hover. Both the list row and the button at the bottom worked correctly on device. Are you testing on device or simulator?

Accepted Answer

In case anyone else runs into this - this is a known issue currently. Please submit a bug report at https://feedbackassistant.apple.com and post the FB number here so that you can track the resolution of it as well.

iOS app running in compatibility mode on Apple Vision Pro does not apply hoverEffect to SwiftUI View
 
 
Q