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?

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?

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