Xcode 13.2.1 swiftUI Previews crash

update Xcode13.2.1 from App Store, the swiftUI previews function crashed, it alerts: "file '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.2.sdk/usr/lib/swift/shims/System.h' has been modified since the module file '/var/folders/hd/64g86r110qq26_sj_p88w9x81mrjx0/C/clang/ModuleCache/12TRQXIDQ8QQD/SwiftShims-2TTN5UXQBRCCQ.pcm' was built: mtime changed"

Answered by bestswifter in 698869022

Meet the same problem in Xcode 13.2

I just used rm -rf /path/to/C/clang/ModuleCache command to delete ModuleCache and it works now

I am having this same issue with all of my swiftui projects, including newly created ones

Accepted Answer

Meet the same problem in Xcode 13.2

I just used rm -rf /path/to/C/clang/ModuleCache command to delete ModuleCache and it works now

same problem, i tried Cleaning Xcode Derived Data but nothing changed i was able to fix it by going into /var/folders/8x/y1lvpw3s0b33_tbjshybhm280000gn/C/clang and deleting the ModuleCache as proposed by bestswifter

Deleting the ModuleCache worked! A more generic (and safer) way to find and delete it would be:

rm -rf "$(getconf DARWIN_USER_CACHE_DIR)clang/ModuleCache"

Xcode 13.2.1 swiftUI Previews crash
 
 
Q