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.