Search code examples
xcodeswift-playground

Xcode playground keep showing progress icon


that loading icon

When I manually run the code, everything seems okay but I don't know why that progressing icon(?) does not disappear. I waited more than 10 minutes. My computer is MacBook Air (M2)

I don't know what to do.


Solution

  • If I remember correctly, the "ready to continue..." message is part of a feature added in Xcode 10 (Release notes):

    Playgrounds in Xcode now execute code incrementally, compiling new lines of code when you type Shift-Return or press the Run button next to the new line of code. This is especially useful for long tasks that you don’t want to run repeatedly, like training a machine learning model or setting up your live view’s state, and allows you to progressively iterate on your ideas without restarting the playground. (34313149)

    What happens when you press the play button at the bottom (top of the output console), is that your code runs until the end, and pauses - it does not stop!

    enter image description here

    You can now enter new lines, on or below the empty line that shows a circular ▶️ (play button) on the left.

    enter image description here

    Notice now the play button, and the line numbers for the new lines becomes blue, indicating that there is new code that is not run. If you now press that ▶️ on the left, you can now compile and run just the new lines you wrote, without recompiling and rerunning the previous lines.

    That is what it means by "ready to continue".

    The spinning wheel is just indicating that the playground execution hasn't stopped. it's waiting for you to run new lines of code (which you haven't written yet).

    You can terminate the playground execution by clicking on the stop button at the bottom (top of the output console). There will not be a spinning wheel after that.