Closed denizdogan closed 2 years ago
Indeed. Shark breaks SwiftUI previews unless you've checked the "For install builds only" checkbox.
This relates to #25.
Off the top of my head, there are two approaches:
1.) Let Xcode handle this by adding the necessary dependencies (Storyboard files, Asset catalogues, and Localizable.strings) to the Input files and adding the output file – perhaps even add a command line Switch where Shark emits this list.
2.) Let Shark handle this by saving the timestamps and/or hashes of its (computed) input files and not generating any new output if nothing has changed.
My gut feeling is that 2.) might be the better way. What do you think?
@mickeyl I would agree that 2) seems like a more suitable solution! I would probably go for hashes myself, unless that proves too computationally expensive.
@denizdogan This is the most simple solution I could come up with. Instead of caching anything or computing hashes, let's just compare the existing output with the new output. Since we're typically not dealing with megabyte-long files, I assume this to be a workable solution.
Please confirm whether this fixes it for you.
@mickeyl The issue seems to have been resolved! Thank you!
Unless you run the Shark script with "For install builds only", the automatic preview of SwiftUI in Xcode keeps popping up "Automatic preview updating paused". I'm guessing this is because it detects changes to the relevant source code.