2

Are playgrounds created in Xcode compatible with the iPad Playgrounds app? That is, can I drop it into the iPad app's Documents folder (or otherwise use iCloud Drive, etc) to load a playground created in Xcode?

Googling neither confirms nor deny this.

2

I just tried running one on my iPad Air downloaded from this Swift Blog post as well as the ones found on the Resources Page and most of them just returned errors. You may see the attached image. Tests were run on iPad Air running iOS 11 Dev Beta & XCode playground Beta a well as further testing on an older iPad Air running iOS 10.3.3 and Xcode Playgrounds (older version)

The following error message is displayed:

Error Compiling Source

Error: Sources/CoreGraphicsDiagramView.swift:2: no such module 'XCPlayground'

Proof available at link posted below.

https://i.stack.imgur.com/t6qZY.png

  • How about the released versions? Xcode 8.3 Playground and iPad Playground 1.5, on Swift 3.1 sources. – adib Jul 15 '17 at 4:27
  • 1
    Nope. Tried on my moms iPad to see... didnt work. Same error. – bret7600 Jul 15 '17 at 11:37
0

Xcode Playgrounds and Swift Playgrounds are indeed compatible. In fact, they both use the same .playground files and a Playground created with one may be opened with the other.

The errors experienced by bret7600 are coincidental to different versions of Swift being used and the code not being updated to reflect the changes. For example, in the posted screenshot, this error occurs simply because XCPlayground was renamed to PlaygroundSupport and the import statements in the code need to be updated to reflect that.

In general, the most recent release versions of Xcode and Swift Playgrounds (the iOS app) should be using the same version of the Swift toolchain and therefore will be compatible.

Warning: Although Xcode is perfectly capable of opening and running playgrounds created on iPad and vice versa, there is an important difference. While the iPad app fully supports iCloud, Xcode does not. As a result, you should not try editing the same file on iPad and Mac at the same time, and you'll need to re-open the file in Xcode to see any changes you made on iPad. This is perhaps why the "Playgrounds" iCloud Drive folder is hidden on macOS in Finder.

You must log in to answer this question.

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