Questions tagged [playgrounds]
15 questions
5
votes
2 answers
How to STOP a program in DartPad?
Using DartPad, how do you stop the current program without losing all your code?
As it is, it seems there is only:
a RUN button
a RESET button (which wipes your code)
The answer is not:
"just leave it running and click RUN again,"
(because…

Nerdy Bunz
- 6,040
- 10
- 41
- 100
2
votes
2 answers
Connect TextEditor text count to ProgressView in SwiftUI
I'm creating a journaling app that would encourage the user to write at least a 100 characters in the Morning Pages section. I’d like to do that by placing a ProgressView at the bottom of a TextEditor. The progress bar would then go from 0 to 100%…

Peter Poliwoda
- 563
- 2
- 7
- 19
1
vote
1 answer
EXC_BREAKPOINT (code=1, subcode=0x18f6dd21c) error in Swift playground Xcode 13.3.1
I have written the following code as part of Swift bootcamp challenge. This code runs perfectly on Replit but when I run the code on the playground in Xcode 13.3.1 I get a huge block of error. Please help me figure out whats the error about.
var…

let-butterChicken
- 13
- 1
- 4
1
vote
1 answer
@State is not working on iPad Swift Playgrounds
I'm trying to use SwiftUI on my iPad with Swift Playgrounds. The view below renders fine initially, but unfortunately the view does not update when @State changes, like it does on my Mac. In the little sidebar I can see the closure does get executed…

Rick
- 59
- 5
1
vote
2 answers
how to resize a view in live playgrounds ?? Xcode
I am planning to create a live playground for coming wwdc scholarships but I have no experience in creating live playgrounds because I have worked with single view apps so far
I actually don't know what size should be the view in my playground and I…

Yuvraj Agarkar
- 125
- 1
- 10
1
vote
1 answer
Is there a way to run a test using XCTest multiple times just with different values?
I'm currently working on a project trying to determine how long different sorting algorithms take to sort different sized arrays. To measure the time, I've decided to use XCTest in Swift Playgrounds since it can automate the process of running the…

wrongsyntax
- 31
- 6
1
vote
1 answer
SpriteKit node going through wall
I'm working on an Xcode Playground and I'm having some problems with SpriteKit collisions.
The first box has a mass of 1 and the second box has a mass of 100000 (when the latter is 100, for example, everything works fine). The collisions are…

João Gabriel
- 73
- 3
- 9
0
votes
0 answers
How to connect Jimu MeeBot with Swift Playgrounds?
I am a coding instructor teaching Swift to students aged 8-10. Following Apple curriculum, I can connect Playgrounds to the robot Jimu Meebot and use Swift to command the robot to dance.
Years ago, Meebot lesson appeared in Playgrounds interface, so…
0
votes
0 answers
Passing Variables into other Variables and across files with SwiftUI
I want this file(file2) to revvieve edge input results of file1, modify them as desired then send them along to file 3 (charts) for realtime feedback. how do I pass variables into other variables as well across files while keeping the information…

Justin Venable
- 1
- 1
0
votes
2 answers
Swift Playground didn't recognize structs in other folders
I'm using AVAudioEngine of AVFoundation with SwiftUI in Swift Playground and using MVVM as Architecture. But if I separate my structs in files, I receive two errors: Execution was interrupted, reason: signal SIGABRT. and Cannot find file in scope.…
0
votes
2 answers
Why does a playground open to a blank screen that says "No editor" the first time I open it in Xcode 10?
I am following the App Development in Swift course in Apple iBooks and I've downloaded the course materials. The first time I open a playground from the Student Resources folder it opens up to a blank screen that says "No Editor." If I close it and…

Laura Ruival
- 11
- 4
0
votes
2 answers
How do I add an image in Playgrounds for iPad?
I’m writing a simple 2D game using SpriteKit with Playgrounds for iPad. I’m trying to add a menu button using the following code:
SKSpriteNode(imageNamed: )
How do I point to an image? I’ve tried adding an image to the project using the little plus…
user13501445
-1
votes
1 answer
Is there a substitute for onAppear?
I am a novice at SwiftUI and I am playing around with Text-To-Speech functions. I have gotten it to work, but I now want the app to automatically speak a string when opened.
I have set it up like so:
import SwiftUI
import AVFoundation
struct…

KodeKat
- 15
- 4
-1
votes
1 answer
Xcode 12.4/Swift Playgrounds: Code does not generate View
I am new to Xcode 12.4/Playgrounds, and am trying to get this code to run. So far, it doesn't generate the View object, and does not generate an error code either. Any ideas about what I'm doing wrong?
import SwiftUI
import PlaygroundSupport
struct…

Paul Denlinger
- 15
- 2
-1
votes
1 answer
Anyone know how to make a multiple choice game in swift playgrounds?
I was wondering if anyone knows how to make a multiple choice game in swift playgrounds with SpriteKit? I don't want to move over to UIController because I prefer spritekit, but I can't find any code on how to make one. Any help would be…

Classic Boat 2.0
- 27
- 3