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
To open Playground on Xcode, navigate to File in the menu and click on New > Playground... To test our square function, we will choose the Blank template. Name your Playground file, then click on Create.
Interactive playgrounds help you to quickly prototype and build your applications, and simply provide another great way to interact with your code. An Xcode project, however, creates a new asset folder and pre-made swift and storyboard files. Save this answer.
Swift in Sixty Seconds takes my introductory Swift tutorial and packages it up in an interactive playground you can experiment with. You get both the text and the videos, all offline on your iPad or Mac.
It may not help you in your job directly, but it teaches useful skills and creates a basic knowledge of the fundamental workings of the products and tools we all use every day. It's not just something kids should do at school, but an important part of an ongoing education for adults.
That's the path that iOS playground use. If you make a macOS playground it will have the path ~/Documents/Shared Playground Data
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With