XCode: no click possible in the preview and in the simulator

Hello, I'm new to Xcode and trying to understand the first programs. Unfortunately the buttons don't work in my preview and simulator. You can't trigger a click with the mouse. But as soon as you use your own iPhone instead of the simulator, the clicks or taps on the buttons work. With the Accessibility Inspector it is possible to control the buttons and trigger the click. Everything works fine on my MacBook Air, just not on my iMac. I haven't found anything similar on the forums either. I've already completely erased and reinstalled Xcode, swapped out the mouse and keyboard, tested various settings in Xcode and the simulator, and compared MacBook and iMac, all to no avail. The mouse does not trigger a click on the simulator. What do I have to set in the Xcode editor or in the simulator so that the buttons work in the preview and simulation mode? I'm really grateful for any help or advice.

Xcode: Version 14.3.1 (14E300c) iOS16.4 iMac: 3.4GHz quad-core Intel Core i5 / 32GB 2400MHz DDR4 Simulator iPhone 14 / 13 Pro / SE (2.) / XS


import SwiftUI

struct ContentView: View { var body: some View { HStack { Button("Tap me") { print("tapped1") } Button("test") { print("tapped2") } } }

}

struct Previews_ContentView_Previews: PreviewProvider { static var previews: some View { ContentView() } }

Hi,

Sorry to hear you are having problems getting interactions in previews working. Best next step will be to file a feedback with diagnostics so we can take a look. We will need the diagnostics Xcode Previews generates in order to make sure we understand the error the previews system is encountering.

If you are having issues with macOS, catalyst or on-device iOS previews then download and install the logging profile for your device. Instructions and profiles are available here: https://developer.apple.com/bug-reporting/profiles-and-logs/?name=swift Attach the sysdiagnose to the bug report as well as the diagnostics using the instructions below.

  1. Start a screen recording using the Screenshot.app (make sure to enable Show Mouse Clicks)
  2. Reproduce the problem
  3. Click the "Diagnostics" button in that banner (or if the banner is missing you can use the menu: Editor > Canvas > Diagnostics)
  4. In the sheet that appears, click "Generate Report" in the bottom left of the sheet
  5. Attach (or make from the folder) the resulting zip file to the bug (will be named something like previews-diagnostics-0123456789.zip)

Hello, Thank you for your answer and your help. I have now compiled the desired information (3 files --- relatively large) Where can I send the information to?

Has there been any response to this? I am having the same problem now in multiple XCode apps. The mouse works for a little bit and then just stops working (both in the simulator and the canvas — same exact problems). This just started for me. I was getting some sort of an error message stating that I needed a valid session ID or something, but I cannot get that back.

XCode: no click possible in the preview and in the simulator
 
 
Q