I recently moved a few playground files from my documents folder to iCloud Drive. Then I noticed they all the files have been duplicated and non can be opened. I moved them back to the original location to the documents folder and still they don't open.

Any suggestions on how I can bring back the codes I've written?

enter image description here

UPDATE: I had a copy of one of the files in my dropbox. It turns out the playground file, consists of a few files and some files were missing or didn't get uploaded to iCloud. (iCloud bug? Shame!)

So then I took a look at the contents (right click > show package contents) and found a swift file which had my code in it.

enter image description here


This happens when you zip and unzip files and Mac turned some files into .xml file depend on your mac settings. The solution is: right-click the "xxx.playground" file -> show package content, you will see the "contents.xcplayground" file. Right-cilck this file and go to "Get info". Now in file name and extension section, remove the .xml at last.

Do the same for "contents.xcworkspacedata" under the "playground.xcworkspace" workspace folder.enter image description here


I encountered the same problem after moving my iOS development project folders from one place on my internal HDD to another. I used a command line terminal window to navigate into my PlayGround folder and drilled town to:


Finding UserInterfaceState.xcuserstate at the bottom of this path, I edited it and updated a number of file paths according to the folder reorganization I'd done. I then navigated to 20160519.playground and opened it with Xcode. This time I didn't get the error; instead it gave me a Loading... message but the load never completed.

I think I'm on the right track to working around Xcode's location rigidity problem but there's apparently a detail or 2 more to find and update according to my folder reorganization.

  • I was able to pick up where I'd left off on my playground project by navigating all the way down to the playground.xcworkspace file and opened that with Xcode. – Dave Sieving May 26 '16 at 22:14

In my case, I had some old playground files which gave the following error when trying to open them in a newer version of Xcode:

Playground file is missing a "Contents.swift" file.

My solution was to right-click on the playground file and select Show Package Contents. In my package file, I found a file called section-1.swift.

enter image description here

I renamed this file to Contents.swift. After that I was able to successfully open the playground file.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .