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
For me, the issue was the fact that MyPlayground was syncing to iCloud. Xcode saves your files every few seconds, and it leads to "not responding" states.
So there is a simple solution- just go to:
System Preferences - Apple ID - Apps on this Mac using iCloud- iCloud Drive - Options- And then uncheck "Playground"
That little trick helps to solve frozen "Running".
I have tried the following and it worked for me:
Buggy Simulator's main process is still working even after Xcode closing. So here're the steps:
com.apple.CoreSimulator.CoreSimulatorService
process in Activity Monitor;Ans. Switch to macOS platform
When you create a Playground, by default it select iOS platform and automatically imports UIKit. It's the UIKit which crashes and stuck all the time. If your (practice) code does not use UIKit then you can switch to MacOS platform. As major (not exact though) difference between iOS and macOS is in APPKit and UIKit.
In the upper right corner of your Xcode Playground, click on show/hide Utilities--> file inspector --> Playground Setting--> Platform--> macOS
See screenShot below:
Adding import PlaygroundSupport solved the problem for me :)
In my case the problem was user-induced. I had the assistant editor displayed, but the live view wasn't selected. Make sure it looks like this:
And not like this: