Xcode is marking all symbols as 'undeclared type' yet they are visible and the project compiles fine

74 views Asked by At

Just to get some context here is a screenshot, though you probably gathered this from the title:

enter image description here

Xcode is marking all symbols as undeclared, usually this would be because it doesn't exist or isn't imported, but in this case it was working fine 20 minutes ago and weirdly the project compiles and runs with no problems.

When I compile the errors go away but there is no syntax highlighting, as soon as I start to edit the file the errors all come back. I can work if I remember the exact signatures for anything that I need to use but with the lack of code completion and errors this is very hard.

Notably this is only a problem in a few source files, its not even the whole project. Nothing has changed that I am aware of that could cause this.

Before anyone suggests it, I have tried cleaning, deleting derived data/build folder, restarting Xcode etc...

My colleague is seeing the exact same issue on his machine.

1

There are 1 answers

0
Jacob King On

So I managed to fix the offending source files, I just compared their attributes to those of a working source file and it turns out that the problem files included the tests project in their target membership and the working file did not. I'm not sure why this is causing the issue as other projects use automated testing without a problem. Nonetheless this solved it for me, at least until I start writing test cases...