View Changing in Simulator not Preview
I've noticed that these lines of code, whenever I run them in the simulator, it would preview the changes in view.
However, whenever I run them in the Xcode preview, it wouldn't change the view at all? I'm quite confused about this.
4 Replies
@outsharded - Do you know?
#how-to-ask
@Coach
LOL here are a few suggestions. First of all, just know Xcode can be weird sometimes and it can 100% be not directly related to your code.
Build and Refresh: Sometimes, the SwiftUI preview might not update automatically. Try stopping the preview and then re-building the project. You can also try clicking the "Resume" button in the preview canvas to refresh the preview manually.
Clean Build Folder: Go to "Product" in the Xcode menu while holding the Option key, and you'll see the "Clean Build Folder" option. Then, rebuild the project and check if the preview updates.
Restart Xcode:
Check for Errors: Make sure there are no errors or warnings in your code that could be preventing the preview from updating. Check the console for any error messages that might provide clues about what's going wrong.
Try Different Preview Devices
Update Xcode
Create a new project to see if the issue persists there with the same code
It could be due to a bug in Xcode itself.