skip to Main Content

Code text in ViewController.swift in Xcode is suddenly not colored anymore (keywords, objects, etc.) except for types like string and int. Also autocompletion is not working anymore. Any other swift file within the same project, like AppDelegate for example is still fine, i.e. colored. Simulation of my project is also still working. I am using Xcode 12.4, macOS 10.15.7. It’s only happening with this specific project I’m working on, all my other projects are still ok. Restarting Xcode/rebooting the computer didn’t help. Any help is very appreciated, thanks!
Here is a screenshot

2

Answers


  1. Chosen as BEST ANSWER

    Update: Clearing the folder Derived Data and cleaning the build folder didn't help, so I deleted "ViewController.swift" after copying the code and then pasted that code into a newly created file "ViewController". Seemed to be a bit of a "nuclear option" to me, especially since I still don't know, why this happened in the first place. But it did the trick.


  2. Try clearing the Derived Data folder and then restarting your Mac.

    click – Command and then , key

    Go to Locations>Derived Data and delete the folder

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search