We have an MLPackage file in our SwiftUI project. Whenever we try to load Previews on a View file, Xcode gets stuck in an infinite loop of "Build for Previews". The builds succeed, but immediately start another build. So, there's no way to actually see/use Previews.
Note: The warnings are not relevant.
Checking the Console logs (not in Xcode) shows this:
Xcode (PreviewsPipeline)
=== Requesting updating previews for reasons [
File "foo.mlpackage" changed,
Preview Settings changed,
]
Taking the models completely out of the project fixes this issue, so I'm pretty sure they're the cause. We're also encrypting the models at compile time, but that is disabled for Debug builds. We also tried removing the encryption step completely with no joy.
As I (poorly) understand it, the mlpackage has metadata, a .mlmodel file describing the topology, and a compressed weights.bin which contain the NN weights. My guess to what's "changing" in that file is the runtime doing some pre-compilation or decompression and storing the result in that package/file.
Is there a way to tell SwiftUI Previews to ignore certain files, directories, or patterns?
That way the mlpackage file can change and it won't rebuild previews.
M1 Mac Mini, Xcode 14.2 (14C18)