Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Swift Xcode Index Freezing or Slow

Maybe this is just me experiencing such an annoying "feature":

After upgrading from Xcode 6.0.1 to Xcode 6.1, things changed. Xcode 6.1 is forever indexing the project or compiling source files. The project is not a huge one. It just contains a bunch of Swift files and AWS SDK 2.0 Cocoapods in the workspace. I don't think it should prevent the whole to index and compile smoothly. I tried with some aws-sdk-ios-samples, just to see how Xcode 6.1 works on them, and it ended up in the same forever waiting.

What solutions I have tried so far:

  1. Deleting "Derived Data" in the Organizer, and re-open and workspace. (fail to fix)
  2. "Show Package Contents" on the .xcodeproj file and deleting .xcworkspace as in (Xcode 4 - slow performance)

None of them worked, unfortunately.

P.S. maybe I should try re-creating the project? My computer settings: MacBook Pro (Retina, 13-inch, Mid 2014), Memory 8 GB 1600 MHz DDR3, with Yosemite. (I think this is enough for running this small project.)

like image 487
leonard Avatar asked Oct 21 '14 18:10

leonard


People also ask

How do I stop indexing in Xcode?

Try this: Make an empty folder on Desktop & lock it (Get info > check locked) . Then in Xcode project, file menu > project settings. In derived data settings, choose custom path. Browse to select that locked folder and try if Xcode troubles you now.


2 Answers

I tried many of the suggestions above including splitting files, installing Xcode 6.2 beta, and breaking string concatenation statements. What finally did it for me was splitting an array of dictionaries literal declaration I was using for test data into multiple .append statements.

// This causes indexing/building to hang... var test = [ [ "a": false, "b": "c" ],              [ "a": false, "b": "c" ],              [ "a": false, "b": "c" ],              [ "a": false, "b": "c" ],              [ "a": false, "b": "c" ],              [ "a": false, "b": "c" ] ]  // This works fine. var test = [ [ "a": false, "b": "c" ] ] test.append([ "a": false, "b": "c" ]) test.append([ "a": false, "b": "c" ]) test.append([ "a": false, "b": "c" ]) test.append([ "a": false, "b": "c" ]) test.append([ "a": false, "b": "c" ]) 

Also, for what it's worth, the 6th entry in this array is what causes the issue for me; five works just fine.

like image 122
Zen Avatar answered Sep 21 '22 17:09

Zen


The only working solution for me is to delete all the derived data (not only for the current project, just clean up the whole folder) and then restart Xcode.

  1. Open File / Preferences in Xcode

  2. Click on Locations on the far right of the pop up window

  3. Click on the little arrow icon next to "/Users/Mac/Library/Developer/Xcode/DerivedData"....it takes you to an Xcode folder that contains a DerivedData folder (that contains all of the derived data from your previous projects.)

  4. DELETE the DerivedData folder

like image 22
Remy Cilia Avatar answered Sep 21 '22 17:09

Remy Cilia