Xcode 6 with Swift super slow typing and autocompletion

mllm picture mllm · Sep 20, 2014 · Viewed 22.5k times · Source

Is it just me or Xcode 6 (6.0.1) with Swift seems to be super slow when you type your code, especially with autocompletion?

A normal Objective-C class, even if inside a Swift project, works almost the same as before, so it's Swift that kills it.

Does anyone else experience the same inconvenience? Do you have any idea of how to improve performance?

  • I tried to play with some settings but no luck.
  • I've also of course tried restarting Xcode and the computer with no luck.
  • No other heavy apps are open.

I use a Mid 2009 Macbook Pro (2.26 GHz Intel Core 2 Duo) with 8GB RAM and SSD HD, which is not the newest thing at all, but still not a complete junk.

It is a shame as I was excited to start using Swift and it is now really unbearable.

Thoughts / tips?

Answer

  • Quit Xcode and restart the Mac are not required but preferred.
  • Delete the content of the folder ~/Library/Developer/Xcode/DerivedData
  • Delete the content ~/Library/Caches/com.apple.dt.Xcode

This is a temporally solution, but works greatly.

Below the script using Script Editor app.

tell application "Terminal"
    do script "rm -frd ~/Library/Developer/Xcode/DerivedData/*"
    do script "rm -frd ~/Library/Caches/com.apple.dt.Xcode/*"
end tell

Alternatively, you can create an alias for your terminal like this:

alias xcodeclean="rm -frd ~/Library/Developer/Xcode/DerivedData/* && rm -frd ~/Library/Caches/com.apple.dt.Xcode/*"

You can add that to your ~/.bash_profile and then type xcodeclean on the command line every time you would like to clear those two folders.