Why is playgrounds never compiling?

I am trying to learn iOS development and I thought hoping into playgrounds and I got this code going

import Cocoa

var x:Int = 69
print(String(x))

However its been stuck at this for about 6 minutes


I feel like I am missing something really obvious but it just won't seem to compile ;( I have also tried restarting the IDE too

1 Like

You cannot import Cocoa in Playgrounds. It should give you the error "No such module Cocoa". Try removing it. The code snippet you provided doesn't need modules, it can run with just the standard library.

If you need to import Cocoa, show the file inspector via View > Inspector > Show Inspector and under Playground settings select macOS as the platform.

Unfortunately it still isn't working when removing the reference to the cocoa framework ;(

You can import Cocoa just fine. In fact, it's the default for macOS playgrounds.

As to why this is broken, who knows.

2 Likes

Could you file a bug report on feedbackassistant.apple.com with the appropriate configuration information (e.g. what OS and Xcode versions you are using)? This seems like a serious issue.

idk my apple id im using my moms

Could you share your OS and Xcode versions? I can file a bug report on your behalf.

im on catalina 10.15.6

my xcode version is 12.2

I've reported this as rdar://73169109. In the meantime, it might be worthwhile to try downloading an alternate version of Xcode and seeing if that fixes the issue. The latest version available on Apple Developer seems to be Xcode 12.3, you can download that from https://developer.apple.com/download/release/ or try an older release from https://developer.apple.com/download/more/.

If you are still seeing the issue and are able to file a feedback, then one suggestion I received was that you can collect System Diagnostics (run sysdiagnose on the command line) immediately after the issue occurs (while Xcode is still running) and attach the sysdiagnose file to the feedback.

And if you don't want to use the command line, you can also press Control-Option-Command-Shift-Period, and wait for the "sysdiagnose_*" file to pop up in Finder, and then share that file with us.

Terms of Service

Privacy Policy

Cookie Policy