Playground Support

RSS for tag

Share playground data, manage live views, and control the execution of a playground in Swift Playgrounds using Playground Support.

Playground Support Documentation

Posts under Playground Support tag

39 Posts
Sort by:
Post not yet marked as solved
1 Replies
161 Views
I created a swiftpm project with Xcode Version 13.4.1 (13F100). I changed the target from the default created by Xcode to this:     targets: [         .executableTarget(             name: "App",             path: "App"         )     ] I also changed the package version to 5.6 to match the AboutMe Package file. I also created an App directory and moved all my files (bar the Package.swift file) to it, and I also created a Guide folder and created a Guide.tutorial file based on the example in the WWDC video. I've turned on Author Debugging Mode (this is on Swift Playgrounds on the Mac, I'll try later on Swift Playgrounds on the iPad), but I get no messages other than the "Could not display guide. Try reopening the current project..." I also get a build error that just says "Building failed" What am I missing?
Posted
by mhanlon99.
Last updated
.
Post marked as solved
2 Replies
248 Views
I try to build a swift PlaygroundBookTemplate on Xcode 13 (macOS Monterey 12.0) but it keeps saying that Module compiled with Swift 5.3.1 cannot be imported by the Swift 5.6 compiler (about PlaygroundSupport). I already tried opening with Rosetta and installing older versions of Xcode, but it keeps showing the same error
Posted Last updated
.
Post not yet marked as solved
1 Replies
192 Views
I have reached to Learn to Code 2, Chapter: Types, Corner of The World puzzle. however; I have provided a solution and the Playground did not close the puzzle, but the avatar stop moving as it meets the conditions I set!! I searched the internet and found the solution, I copied the solution, the puzzle closed!! but my solution was much shorter than the solution!! I am not sure what is wrong in my code, I have attached my code. `greenPortal.isActive = false orangePortal.isActive = false var numberOfGems = 0 var numberOfSwitchs = 0 func moveAround() {     if isBlockedRight {moveForward()} else {turnRight()         moveForward()              }     if isBlocked {turnLeft()         turnLeft()     } } turnRight() moveForward() for steps in 1...2 {     moveForward()     turnRight()     moveForward()     if isOnClosedSwitch {toggleSwitch(); numberOfSwitchs = numberOfSwitchs + 1}     turnLeft()     turnLeft() } while !isBlocked {     while numberOfSwitchs < 6 {         moveAround()         if isOnGem {collectGem(); numberOfGems = numberOfGems + 1}         if numberOfGems == 6 {greenPortal.isActive = true}         if isOnClosedSwitch {toggleSwitch(); numberOfSwitchs = numberOfSwitchs + 1}         if isOnOpenSwitch {greenPortal.isActive = false}     } }
Posted Last updated
.
Post not yet marked as solved
0 Replies
152 Views
I just installed Swift Playgrounds on newly installed Monterey. There is not much else installed (ie, no Xcode). The initial screens of Playgrounds seem to render properly (ie against the blue background). Then when the lesson begins the instruction and coding window appear fine, but the right panel is just a blue background with either nothing at all or a tiny little box at the top of screen that says 0/1. It seems like the animations are not rendering. I have tried to reinstall but same issues. This seems to occur in all the lessons. I have no idea where to even begin troubleshooting this and I have searched the internet and nothing similar seems to be mentioned. Suggestions?
Posted
by Clueless1.
Last updated
.
Post marked as solved
2 Replies
321 Views
If i doing on playground on macbook. Can i send a file extention swiftpm ? I see a rule its said must be .swiftpm but .swiftpm is create from xcode. I would like to know Can playground save a file to extention .swiftpm? or I must do only in XCODE Im very confused Thank you in advanced.
Posted Last updated
.
Post marked as solved
2 Replies
508 Views
Hi !, For this year's WWDC Student challenge we need to create a swift playgrounds app but I have designed a swift playground book with chapters and multiple pages. Now I need to convert it into the swift playgrounds app, How can I do it ? I am completely new to swift and Xcode. Just started to learn swift about 15 days ago. So any help would be appreciated Thanks in advance cheers, Sanjiv Anand
Posted Last updated
.
Post not yet marked as solved
0 Replies
245 Views
Dear Teams, I try to transfer this Xcode sample project to the Playground app project. However, when I move all swift files and the CoreML file called 'ExerciseClassifier.mlmodel' on the folder to the Playground app project, it shows the error, "Cannot find type 'ExerciseClassifier' in scope". What could I do to remove the error and make a proper working project on Playground? Thanks.
Posted
by yerin16.
Last updated
.
Post marked as solved
1 Replies
1.6k Views
Hi, I tried to open swift playgrounds author template in Xcode 13.3 but it shows the following error when I build the app Command EmitSwiftModule failed with a nonzero exit code But the template is for Xcode 13.2 but for the swift student challenge we need to use Xcode 13.3 to build the playground. Is there a updated version of the template??
Posted Last updated
.
Post not yet marked as solved
1 Replies
228 Views
Learning Swift. When I create a new playground the output doesn't appear in the right-hand panel as I code. Can someone tell me why, and how to fix?
Posted
by wjnick.
Last updated
.
Post not yet marked as solved
0 Replies
306 Views
I’m building a playgroundbook for the upcoming swift student challenge and am confused with the whole rules about fetching data from the internet in my playgroundbook. I have implemented the speech framework in one chapter and am implementing it so that it is to be done offline. The problem is that this is only possible on iPads with an A12 Bionic chip or newer and thus the older iPads and even my mac shows an error when Wifi is turned off. So I’m concerned as to whether my submission will be accepted in such a case or not?
Posted Last updated
.
Post not yet marked as solved
1 Replies
926 Views
I'm creating a test that has 5 buttons, each one corresponds to a specific color, the problem is that when I select a consecutive 2nd button, the previous button is still selected, how can I make my code select only one button at a time and deselect the previous one?
Posted
by Yanes.
Last updated
.
Post not yet marked as solved
0 Replies
214 Views
Hi, I’ve been on Sphero Swift Playgrounds 2; Randomise Game for a while and I need help. This is my code; func pickNextGesture(availableGestures:[Gesture]) -> Gesture { randomNumber(min: 1, max: availableGesture.count) return .tap return .toss return .spin return .shake
Posted Last updated
.