Search code examples
iosxcodeswiftxcode7

Xcode hangs on "Compiling Swift source files"


I'm running Xcode 7.3.1. When building my Swift based project, it hangs on "Compiling Swift source files". I've tried various combination of deleting DerivedData, clean, run, restarting Xcode, restarting OS X, none seem to work. Any ideas?


Solution

  • Thanks for all commentors' suggestions. I narrowed it down to a map's closure referencing a property that I had removed. Example:

    var people: [Person] = ...
    let foo = people.map { "\($0.name), \($0.age)" }
    

    where Person looks something like:

    protocol Person {
        var name: String { get }
        var age: Int { get }
    }
    

    This all works fine. Then I removed age while keeping the closure unchanged. This caused Xcode to become hopelessly confused. Probably related to the Swift's type inference.