2020-07-16 Error in SwiftUI preview

Last edit

Changed:

< Edit 2021-01-15: removing all unittests also "fixed" this problem.

to

> Edit 2021-01-15: the above solution was only temporary. Another attempt involved removing all unittests also temporarily "fixed" this problem. At the moment, this seems to be a very rare error and I have not been able to find a definitive cause or solution.


Today, one SwiftUI Preview would not show anything. The Diagnostics button showed the following error:

    GenericHumanReadableError: unexpected error occurred
    noPreviewInfos(arch: "x86_64", sdkRoot: "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.6.sdk")

After a bit of fiddling, I found out the cause. This project had multiple targets. And the file was not a member of the currently selected target.

Edit 2021-01-15: the above solution was only temporary. Another attempt involved removing all unittests also temporarily "fixed" this problem. At the moment, this seems to be a very rare error and I have not been able to find a definitive cause or solution.