Danny Danny - 2 months ago 51
iOS Question

XCode 8.0 Swift 3.0 slow indexing and building

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 files). I am also using

Pods
. Indexing of previous XCode version (< 8.0) worked fast but now, after upgrade, the progress bar is stuck on one position (I am already waiting for an hour).

Things I've tried that didn't help me:


  • Cleaned the
    DerivedData
    folder and restarted XCode

  • Cleaned the project and restarted XCode

  • Deleted
    Pods
    directory with
    <project>.xcworkspace
    and then installed again

  • Restarted Mac

  • Tried build project without Pods

  • Reinstalled XCode

  • Tried on another Mac with cloned project



It is really not cool to make such releases of software when developers have to spend hours on solving such ridiculous problems. It is very disappointing.
Any ideas how to fix this?

Answer

I solved the problem by commenting all files and then removing comments one by one. I found that the problem is still in the array declaration as described here.

I had code like this and project was not indexing:

class {
    var first: String!
    var second: String!
    var third: String!
    var fourth: String!
    var fifth: String!

    func abc() -> [String] {
        var dict = [first, second, third, fourth, fifth]
    }
}

I've changed it to this and indexing started working:

class {
    var first: String!
    var second: String!
    var third: String!
    var fourth: String!
    var fifth: String!

    func abc() -> [String] {
        var dict = [first]

        dict.append(second)
        dict.append(third)
        dict.append(fourth)
        dict.append(fifth)
    }
}