I am somewhat new to Xcode and Swift and trying to figure out why I cannot see the previews in SwiftUI.
OS and Xcode are both latest non beta versions (macOS 10.15.5 and Xcode Version 11.5 (11E608c).
I have not even written any code, just created the default project (Hello World!) and then clicked the "Resume" in the preview.
It shows "Cannot preview in this file - Update failed".
Clicking on the info says "NewTest.app may have crashed. Check ~/Library/Logs/DiagnosticReports for any crash logs from your application." - but when I open the location there are no files.
I then try to run it in a simulator (defaulted to iPhone SE but works with any) and it runs fine.
The diagnostics show (start with) this:
Error Domain=com.apple.dt.UITestingAgent Code=-1 "failed to load library at path "/Users/xxxxxxxxx/Desktop/Swift/NewTest-ckvagdimpxrjjigjrqusmkwfddix/Build/Intermediates.noindex/Previews/NewTest/Intermediates.noindex/NewTest.build/Debug-iphonesimulator/NewTest.build/Objects-normal/x8664/ContentView.2.preview-thunk.dylib":
I tried several things per suggestions I have seen elsewhere but none have helped (Including complete re-install of Xcode, multiple restarts, deleting build folders and rebuilding etc.)
Seems like a fundamental issue but due to my lack of experience with Xcode I am not sure how to troubleshoot it.
The default project:
import SwiftUI
struct ContentView: View {
var body: some View {
Text("Hello, World!")
}
}
struct ContentViewPreviews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
OS and Xcode are both latest non beta versions (macOS 10.15.5 and Xcode Version 11.5 (11E608c).
I have not even written any code, just created the default project (Hello World!) and then clicked the "Resume" in the preview.
It shows "Cannot preview in this file - Update failed".
Clicking on the info says "NewTest.app may have crashed. Check ~/Library/Logs/DiagnosticReports for any crash logs from your application." - but when I open the location there are no files.
I then try to run it in a simulator (defaulted to iPhone SE but works with any) and it runs fine.
The diagnostics show (start with) this:
Error Domain=com.apple.dt.UITestingAgent Code=-1 "failed to load library at path "/Users/xxxxxxxxx/Desktop/Swift/NewTest-ckvagdimpxrjjigjrqusmkwfddix/Build/Intermediates.noindex/Previews/NewTest/Intermediates.noindex/NewTest.build/Debug-iphonesimulator/NewTest.build/Objects-normal/x8664/ContentView.2.preview-thunk.dylib":
I tried several things per suggestions I have seen elsewhere but none have helped (Including complete re-install of Xcode, multiple restarts, deleting build folders and rebuilding etc.)
Seems like a fundamental issue but due to my lack of experience with Xcode I am not sure how to troubleshoot it.
The default project:
import SwiftUI
struct ContentView: View {
var body: some View {
Text("Hello, World!")
}
}
struct ContentViewPreviews: PreviewProvider {
static var previews: some View {
ContentView()
}
}