SwiftUI Preview fails with "RemoteHumanReadableError: Could not connect to agent"

I added a basic Hello World SwiftUI view to an existing UIKit project, yet I can not get the preview to work.

Usual error is:

MessageSendFailure: Message send failure for send render message to agent

==================================

|  RemoteHumanReadableError: Could not connect to agent
|  
|  Bootstrap timeout after 8.0s waiting for connection from 'Identity(pid: 30286, sceneIdentifier: Optional("XcodePreviews-30286-133-static"))' on service com.apple.dt.uv.agent-preview-service

Neither this nor the generated report is very helpful.

I also created a new Xcode project to see if the same View works in a new test project, which it does.

If my project compiles without warnings and errors, but SwiftUI preview fails, what are the options I have left? (My deployment target is IOS14, my Xcode is the fresh Xcode 13.0)

  • I'm having almost exactly the same error (different pid value and different number after XCodePreviews). Also using XCode 13.0. This is in my main project, and previews were working, albeit sporadically, until a couple weeks ago.

Add a Comment