When developing a project in Objective-C everything is smooth, SourceKitService
is taking 0% of CPU, autocompletion is almost instant.
But if I change a Swift code a bit, it takes many seconds to do anything (highlight syntax and check, whisper etc.) Or when i want to see an implementation of something with cmd
shortcut, again SourceKitService
on xxx% of CPU and takes seconds. Changing a character in code leads to 10 seconds of waiting to see everything is ok is too much.
Sure I tried to delete derivedData
, ModuleCache
, com.apple.dt.Xcode
etc. as advised but it is not permafix, still happening, slowing me down.
Does anybody know how to really fix this issue or at least improve it?
In this case it had something to do with CocoaPods
. It was copying .h
files into the build directory and SourceKit
was getting confused.
I added this script to my project, and SourceKit
stopped freaking out a bit, but it is still ridiculously slow.
function removeHeaders() {
find $BUILD_ROOT/Debug-iphonesimulator/ -name '*.h' -exec rm -f {} \;
}
removeHeaders
Ref. Xcode Swift Syntax Highlighting and Code Completion Completely Broken
Note: Unfortunately this solution breaks debugging console and archiving. So remove the script if it is needed.