I\'ve installed Xcode 8.0 and converted Swift 2.2 to 3.0 (that process also took a lot of time, I just left my Mac running all night). I have not a big project (about 20 fil
This works for me in Xcode 8.2.1 and Swift 3 when "Indexing" is stuck:
I always have two projects open, a dummy project and the project I'm working on. I also have a iPad Air device connected that I run my projects on. When my project gets stuck on "Indexing", I switch to my dummy project and run my project on my connected iPad Air device. Then I stop the project and switch back to the project I'm working on and the "Indexing" is magically finished. This should also work with the simulator only, if you don't have a physical device connected.
I had the same problem and solved it by painstakingly going through my code line by line, it turns out Swift 3 prefers string interpolation rather than using the + symbol, i.e.
let url = "http://yahoo.com" + "someWebPage" + "whereItsInteresting"
If you have been using the above style of code replace it for;
let url = "http://yahoo.com\(someWebPage)\(whereItsInteresting)"
And your build time will immediately come back to normal.
I encountered the same indexing issue, but it occurred only when I was running/debugging on a device and then switched to another device on the top-left toolbar (Target > iPhone).
None of the solutions above worked for me.
My solution: I removed my local git working copy and cloned a new one from my 'origin'.
(There are some 'magic' files within the xcuserdata/shared/session etc. folders that may have caused this issue?)
I've had the same issue only since upgrading to Swift 3/XCode 8 and it seems to be caused by large array literals.
I was able to fix the issue by adding type annotations to the variables being assigned to the array literal, e.g.
let array: Array<String> = ["1", "2", "3", "4", "5", "6", "7", "8"]
instead of
let array = ["1", "2", "3", "4", "5", "6", "7", "8"]
for those who want to find where compiler is "caught"
Add to Other Swift Flags
-Xfrontend -warn-long-function-bodies=50
check full answer here
Backup your project delete the last update project after backup and then restart Xcode simple :-)