This is one of the worst errors you can encounter while developing with Xcode.
It looks like it's related to a problem inside the compiler itself: when there are lot of lines of code, it becomes unable to identify them all and start asking you to break down the code in smaller pieces. Sometimes you can, sometimes not.
First of all, in your code there is FOR SURE an error, so in case of the second option, begin commenting entires sections of your code: this can lead to two options:
- You commented a section that contains the error: Xcode give you the preview and you check the commented section to find the error
- You commented enough code to let the compiler do its job, and you'll have the normal error reported in your code: again, fix it!
Once errors have been fixed, normally you can uncomment what you excluded and all will go up and ok again.
The most common errors that can lead to this behavior (but it's just a hint) are those involving parameters got or passed to other SwiftUI objects:
- parameters label (mistyped, missing, exceeding)
- parameters values (not $/& present, $/& present but not required)
- parameters types (you passed a wrong type)
Well, I hope that this post could be useful to others that, like I did, are struggling a lot to understand the exact nature of this peculiar error.
Code well and Prosper!