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?
I made a class extend itself. That also causes Swift compiler to get stuck in a loop without error:
class X: X
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.
Something I found useful was the post from RoystonP on https://developer.apple.com/forums/thread/115303?answerId=391817022#391817022:
- Open Activity Monitor.
- Start your project building.
- Wait for the the build’s progress to completely stop for several minutes.
- Locate the Swift processes in Activity Monitor (they should be using nearly 100% CPU) and select one of them.
- In the menu bar, select “View”, then “Send Signal To Process…”
- Select “Abort (SIGABRT)” from the drop-down list.
- Click the “Send” button. This will simulate an assertion failing, so the compiler will print information about what it’s doing and then exit.
- In Xcode, switch to the Report Navigator (the “speech bubble” button over the left-side pane) and select the build.
- Scroll down to the now-failed compilation step and click the transcript button (button with five lines, to the right of the “Compile [Filename]” line).
- Scroll down to see the diagnostic information. It will probably include a list of command-line flags, a few lines saying things like “In pass SimplifyCFG”, and a stack trace.
You might have to repeat step 6 and 7 in order to get it to work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With