Hey Everyone!
I am sure many of us have faced issues with Xcode during our workflow and the experience is not great! It gets frustrating at some point and we get clueless to what must be done! In most cases, these issues occur during a 'git pull', 'rebranching', etc, any sort of general changes to your codebase, or sometimes even randomly show up.
While most can be found online via common forums (like StackOverflow), sometimes none works, and even if you delete the project folder, rebuild, things just don't work as normal!
[General] Fixes (which I am sure you found across the internet):
Delete ~/Library/Developer/Xcode/DerivedData
Clean Build Folder - Command + Shift + K
(If none of above works, try resetting Xcode by, 'defaults delete com.apple.dt.Xcode
')
[Target and Scheme Related] Magical Fixes!
(Always works!)
(This fixed the Xcode Syntax Colouring, Code Completion, Type Hints, Errors, Jump to Definition and many more!):
- Switch your existing
scheme
toswift-frontend
, which is among the generated Xcode Targets when you had added files fromSwift.xcodeproj
during setup - Build with this scheme, yes it fails, but this fixes the complete Xcode Codebase
- Switch back to your original scheme and maybe thank me later :)
You may be wondering why this works, well its because, Xcode gets confused due to multiple targets and schemes and doesn't recognise the files across the project, and behaves quite weird, like a very common one is, when you start typing, random 10+ errors show up, although compilation is successful!
(Doing this, helps Xcode recognise those files and fix its internal working.)
@anthonylatsis Do you think this could potentially be added to 'GettingStarted.md' and/or any appropriate places?
--Thanks