Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode swift indexing forever

I'm currently developing an iOS app using swift and Xcode 6 (Beta 3).

Everything went fine so far but now as my project grows, Xcode suddenly began indexing and it does that again and again, making Xcode nearly unusable.

I have searched the web for similar problems and tried the solutions but none of them did help. Even disabling the indexing process (defaults write com.apple.dt.Xcode IDEIndexDisable 1) does not stop Xcode to do that.

While indexing, my CPU usage goes up to 300%+, causing the fans to run at highest speed.

In Activity Monitor there are several tasks named "swift" taking up about 1GB memory each.

like image 628
zisoft Avatar asked Jul 16 '14 13:07

zisoft


4 Answers

Happened to me with Xcode 7.3

Had to clean everything Xcode had cached to solve it.

Solution:

rm -frd ~/Library/Developer/Xcode/DerivedData/*

rm -frd ~/Library/Caches/com.apple.dt.Xcode/*
like image 40
Fawkes Avatar answered Nov 01 '22 22:11

Fawkes


Killing the processes named 'swift' and then checking the error in xcode will give you the part of the code giving you trouble. There are some bugs in swift that needs to be circumvented.

To kill the process: Applications > Utilities > Activity Monitor. Then find the "swift" process, double click and choose Quit or Force Quit.

like image 96
hannesr Avatar answered Nov 02 '22 00:11

hannesr


I had this same issue and it took me FOREVER to solve it. I'm pretty sure I've seen every question on the internet about this issue and I tried all of the solutions. Turns out all I had to do was....

Restart my computer

like image 17
Alex Avatar answered Nov 01 '22 22:11

Alex


Solved it: I deleted the most recently added files from the project and the problem disappeared. Then I started to add back the files, one by one until the problem reappeared. So I found the file causing the problem. Then I deleted the most recently added code from that file and again, the problem disappeared.

That way, I found a piece of code which was responsible for that behavior.

like image 13
zisoft Avatar answered Nov 02 '22 00:11

zisoft