Xcode 13.2.1 Preview

I am following some tutorials and I am trying to preview my app but I am getting the following error

"Cannot preview in this file - Timed out waiting for connection to DTServiceHub after 15.0 seconds."

This error does not come up when I use other versions of XCode. Is there any way of fixing this? I am using macOS Monterrey

EDITED: that was the answer before you completely changed your question.

Which tutorial ? It is probably for older Xcode 12.

Now, in Xcode 13,

  • if interface is storyboard, lifecycle is UIKit App Delegate
  • if interface is SwiftUI, lifecycle is SwiftUI App

previously you could choose UIKit App Delegate for SwiftUI interface.

So, now with Xcode 13, the choice of lifecycle is determined by the choice of interface. No need to allow a selection.

For your new question

This error does not come up when I use other versions of XCode. Is there any way of fixing this? I am using macOS Monterrey

Xcode: Please be more specific. Which other versions exactly.

Did you read this: https://stackoverflow.com/questions/70608395/xcode-13-2-1-preview-not-working-but-simulator-works

Notes

The command below also works with 13.x.x

https://developer.apple.com/documentation/xcode-release-notes/xcode-13_3-release-notes

Xcode SwiftUI Previews

may occasionally fail with an error message about a modified .hfile, such as “file Header.h has been modified since the module file Module.pcm was built: mtime changed.” (85938686)

Workaround:

Delete the Clang module cache by running the following

command

in Terminal: rm -rf "$TMPDIR/../C/clang/ModuleCache". Then try to preview the file again.

Xcode 13.2.1 Preview
 
 
Q