No output in Xcode

Complete newbie question here. Just installed Xcode and I have set up a very simple "Hello world"- playground. However, when I run it (by pushing the buttons marked with red arrows) I get no output, neither in the console on the bottom or in the righthand sidebar. Am I doing something wrong here?

Thanks a lot!!

Screenshot

There's nothing wrong with the code, it should print just fine.

I noticed that you're using iOS playground, as you can import UIKit.
So my first guess is that when you first pressed (either) arrow, it tries to boot up the iOS simulator (we're not in iOS after all) but you stopped before Xcode successfully start the simulator (it could take a while). You should see "running playground" on the tool bar (the top that says ready) if that's the case.

If you're planning on using the playground for some quick'n dirty, I'd suggest that you use macOS playground instead. It'd be much faster. You can select it when you created the playground.

1 Like

Awesome! Thank you for taking your time to answer.

Switching to a macOs playground fixed the issue! But even if I wait for several minutes I get no response when trying to run the iOS code.

Fixed by uninstalling the iOS simulator and installing it again... Strange that was needed since I just installed Xcode. Seems very buggy so far :neutral_face:

How did you uninstall the simulator? I couldn't even figure out which one is used. :thinking:

After getting additional error messages related to the simulator I followed a bunch of instructions on how to reinstall it, such as these: ios - How to uninstall downloaded Xcode simulator? - Stack Overflow

I also deleted all simulators from the Hardware -> Device -> Manage Devices... in the simulator settings and added one back.

Honestly, I'm not quite sure what of it did the trick, but now it's working so I'm happy for the time being :smiley: