Xcode playground gets stuck on 'Running playground' or 'Launching simulator' and won't run the code, what to do? Xcode playground gets stuck on 'Running playground' or 'Launching simulator' and won't run the code, what to do? xcode xcode

Xcode playground gets stuck on 'Running playground' or 'Launching simulator' and won't run the code, what to do?


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:enter image description here


I have tried the following and it worked for me:

  1. press on the bottom "stop playground" button
  2. remove the first comment line and make import statement the firstline. no space above import.
  3. press execute button


In my case, Xcode 8.3.2, it works when I try as steps below:

  1. File -> Close "Name.playground"
  2. File -> Close Playground
  3. Quit Xcode
  4. Re-open Xcode