SwiftUI: Automatic Preview Updating Error “Failed to build ContentView.swift”

后端 未结 5 1261
渐次进展
渐次进展 2020-12-30 23:16

I\'m trying to run the Automatic Preview in Xcode 11, however even though the project builds successfully, the automatic preview fails giving me the error Failed to

相关标签:
5条回答
  • 2020-12-30 23:29

    First select the Xcode using following command

    sudo xcode-select -s /Applications/Xcode.app/Contents/Developer

    Then run

    sudo xcodebuild -license

    Hope it is helpful

    0 讨论(0)
  • 2020-12-30 23:30

    I solved that problem by going to the Xcode - Preferences -> Locations and assigning the Command Line Tools to Xcode 11. Also keep in mind that it is a beta, so it is unstable.

    0 讨论(0)
  • 2020-12-30 23:31

    I encountered this problem too. I download Xcode beta-1 before I download macOS 10.15. Then after my system upgrade to 10.15, the preview function didn't work. It turns out that Apple has released Xcode beta-2 version recently, so I downloaded and it worked. So, KEEP THE NEWEST VERSION OF XCODE!!!!

    0 讨论(0)
  • 2020-12-30 23:36

    I had this problem as I was using // to comment beside my curly brackets to check I had them all in the right spot in my screen code. Xcode seems to cope with a few but once the screen gets too large and too many comments...... Now I comment on the line below and no problems!

    0 讨论(0)
  • 2020-12-30 23:47

    I had this problem too. I solved it by moving the file location of the file I was trying to preview. When the file was created it was down below the resources folder, so I moved it up and then preview worked.

    0 讨论(0)
提交回复
热议问题