I have a twofold problem here. In some code that is attached to a Button SwiftUI element, I appear to have a syntax error, but I can’t see it. The code is fine (apparently), compiles and runs, but as soon as I add a statement that copies a string, I get errors, but in the wrong place. This is a recurring problem that I’m having with SwiftUI (the inaccurate reporting of an error) – if there is a bug in the code, it is reported, not on the line with the error, but on the element that encloses the code. I have attached two screenshots showing this problem with the error reporting.
So, two questions – first, on the matter of this inaccurate error reporting, I am using Xcode 13.2, but I see that the most recent release of Xcode is 13.3. Upgrading to that is a bit of a pain point, does anyone know if 13.3 fixes the error reporting?
Secondly, I have no idea why taskList = "Happy" would be causing an error. It looks like a simple assign to me.
In the first picture, we have our error. In the second picture, I comment out the string assignment lines and no more error.
What’s really going on here?