Matthew Knippen
Matthew Knippen

Reputation: 1058

Xcode Playgrounds Shared Directory Not Working

When creating an Xcode Playground, the supported playgroundSharedDataDirectory does not properly show my the expected directory.

Expected: ~/Documents/Shared Playground Data

Actual: file:///var/folders/46/zg_mg07d5h5_9t6q_4vr9_2w0000gn/T/com.apple.dt.Xcode.pg/containers/com.apple.dt.playground.stub.iOS_Simulator.MyPlayground-BEF6F13E-994E-45C9-A18E-7DE953069D69/Documents/Shared%20Playground%20Data/

import UIKit
import PlaygroundSupport

print(playgroundSharedDataDirectory)

This also does not link to the directory. If I place a file in the correct directory, I cannot read it. If I place it in the directory, it does work, but it changes every time the playground is loaded.

Xcode 10.3, also appears in Xcode 11. This worked in 10.2

Upvotes: 8

Views: 1746

Answers (1)

Craig Siemens
Craig Siemens

Reputation: 13266

That's the path that iOS playground use. If you make a macOS playground it will have the path ~/Documents/Shared Playground Data

Upvotes: 8

Related Questions