Every time I create a new playground in order to test some code, Xcode gets stuck and won\'t run the code. It simply presents \'Running playground\' or \'Launching simulator
After beating my head on this for a few hours, I realized I had accidentally deleted this, VERY MUCH important line that allows to test UIKit elements before committing my playground onto git:
// Present the view controller in the Live View window
PlaygroundPage.current.liveView = MyViewController()
Facepalm. Hopefully this can help someone from pulling their hair out for a few hours.
after runnning a while you will see error message then you go to view>debug area > activate console and then play again worked for me
I'm using Xcode 10.2 and am getting the same issue. So generally just use Online Swift Playground
This serves my purposes! :-)
Also happens, like in my case, when you've defined a function, but have forgotten to call it?
You can switch to manual processing. It worked for me.
As if this question didn't have enough answers, I will provide my "solution" to the stuck Swift playgrounds problem:
The one solution I've come across which works nicely for me (so I do not have to restart Xcode):
killall launchd_sim
This will cause the spinning "Running Playground..." to go away and you can trigger a new execution. Be aware: the next execution is going to spin up launchd_sim
and all those child processes again. It would probably be best to kill only the relevant child process. But I didn't find it so far.
But I do this only when I'm not using the iOS Simulators in parallel, as the launchd_sim
process is a child process of Simulator
.