Hi,
I have a problem with making a swift playgrounds app walkthrough. I followed the steps exactly and modified my Package.swift a bit (in the targets section):
.executableTarget(name: "App", dependencies: ["Guide"], path: "App"),
.target(
name: "Guide",
path: "Guide",
resources: [
.process("Guide.tutorial"),
])
Now when I open the project in Playgrounds I get this error:
public headers ("include") directory path for 'Guide' is invalid or not contained in the target
Any help would be appreciated.
Thanks
Swift Playground
RSS for tagLearn and explore coding in Swift through interactive learning experiences on the Swift Playground app for iPadOS and macOS.
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
Have downloaded playgrounds 4.3 to my iPad Air running ipados 16.5.
Trying to use playground “Get started with Apps” but receiving message “Unsupported file format Get Started with Apps.swiftpm cannot be opened in Swift Playgrounds”.
I do not have Mac or windows PC so am stuck! Help ??
Topic:
Developer Tools & Services
SubTopic:
Swift Playground
Tags:
Swift
Swift Playground
Playground Support
I am trying to implement a ML model with Core ML in a playground for a Student Challenge project, but I can not get it to work. I have already tried everything I found online but nothing seems to work (the tutorials where posted long time ago). Anyone knows how to do this with Xcode 15 and the most recent updates?
Topic:
Developer Tools & Services
SubTopic:
Swift Playground
Tags:
Swift Playground
Swift Student Challenge
Create ML
Hi there, when I’m using Swift Playground app on my new M4 iPad pro software version 17.5.1 . Soon I’m running the code for the first time. It crashes the IPad and restart it. After it’s fine . Anyone else have the same issues ?
Topic:
Developer Tools & Services
SubTopic:
Swift Playground
I am writing an app in Swift Playgrounds 4.5.1 on an iPad 8th generation running iPad OS 17.5.1. When I click the run button I get the error “MyGame Crashed. Update failed. The operation couldn't be completed. (BSActionErrorDomain error 1.) MyGame may have crashed.” It was working up until a few days ago but now it can’t even show the preview. I haven’t updated the app or software since and I can run other app playgrounds. I have multiple nested views with multiple lists of buttons using ForEach statements and I am sharing variables across views using ObservableObject using code like this:
class UserProgress: ObservableObject {
@Published var score = 0
}
struct InnerView: View {
@ObservedObject var progress: UserProgress
var body: some View {
Button("Increase Score") {
progress.score += 1
}
}
}
struct ContentView: View {
@StateObject var progress = UserProgress()
var body: some View {
VStack {
Text("Your score is \(progress.score)")
InnerView(progress: progress)
}
}
}
Topic:
Developer Tools & Services
SubTopic:
Swift Playground
I created an app using Playgrounds and added a Package from GIt. When I try running the app it fails saying the it doesn't support dynamic libraries. So, my question is why did it allow me to add the package in the first place?
I am currently running MacOS 12.7.6 version and this is the last update on my machine, and swift playgrounds is not downloading in it, so I want its older version, I think I need Swift Playgrounds 4.1, so please give me a solution.
Thank you so much!
Topic:
Developer Tools & Services
SubTopic:
Swift Playground
Tags:
App Store
Swift Playground
Playground Support
Mac App Store
Hi! I have a remote student who's learning to code in Swift using Playgrounds - Learn to Code 2.
It's frustrating to try to test his code when we think he as part of a solution to a puzzle because he can't run his code twice in the same puzzle without resetting the puzzle - when he tries, the page gives an error, and he has to reload the whole puzzle, which erases his code. As a workaround, he's been copying his code and reloading the puzzle whenever he wants to test out a partial solution.
Is there an easier way to do this?
When running the code below in a playground file, it crashes with an LLDB RPC Server crash. The crash log is attached. If I put the code into a project, it runs fine.
lldb-rpc-server-2024-10-04-110747.txt
import Foundation
@objc protocol Speaker {
func speak()
@objc optional func tellJoke()
}
class Deb: Speaker {
func speak() {
print("Hello, I'm Deb!")
}
func tellJoke() {
print("What did Sushi A say to Sushi B?")
}
}
class Bryan: Speaker {
func speak() {
print("Yo, I'm Bryan!")
}
func tellJoke() {
print("What is the object oriented way to become wealthy?")
}
func writeTutorial() {
print("I'm on it!")
}
}
class Animal {}
class Dog: Animal, Speaker {
func speak() {
print("Woof!")
}
}
var speaker: Speaker = Bryan()
if speaker is Bryan {
print("Hi, I'm a Bryan")
}
speaker.speak()
//speaker.writeTutorial() //won't compile
(speaker as! Bryan).writeTutorial()
speaker = Deb()
speaker.speak()
speaker.tellJoke?()
speaker = Dog()
speaker.tellJoke?() //return nil
protocol MtgSimulatorDelegate {
func mtgSimulatorDidStart(sim: MtgSimulator, a: Speaker, b: Speaker)
func mtgSimulatorDidEnd(sim: MtgSimulator, a: Speaker, b: Speaker)
}
class LoggingMtgSimulator: MtgSimulatorDelegate {
func mtgSimulatorDidStart(sim: MtgSimulator, a: any Speaker, b: any Speaker) {
print("Meeting started")
}
func mtgSimulatorDidEnd(sim: MtgSimulator, a: any Speaker, b: any Speaker) {
print("Meeting ended")
}
}
class MtgSimulator: MtgSimulatorDelegate {
func mtgSimulatorDidStart(sim: MtgSimulator, a: any Speaker, b: any Speaker) {
print("the meeting started")
}
func mtgSimulatorDidEnd(sim: MtgSimulator, a: any Speaker, b: any Speaker) {
print("the meeting ended")
}
let a: Speaker
let b: Speaker
var delegate1: MtgSimulatorDelegate?
var delegate2: MtgSimulatorDelegate?
init(a: Speaker, b: Speaker) {
self.a = a
self.b = b
delegate1 = self
}
func simulate() {
print("Off to meeting....")
delegate1?.mtgSimulatorDidStart(sim: self, a: a, b: b)
delegate2?.mtgSimulatorDidStart(sim: self, a: a, b: b)
a.speak()
b.speak()
print("Leaving meeting...")
delegate1?.mtgSimulatorDidEnd(sim: self, a: a, b: b)
delegate2?.mtgSimulatorDidEnd(sim: self, a: a, b: b)
a.tellJoke?()
b.tellJoke?()
}
}//MtgSimulator
let sim = MtgSimulator(a: Deb(), b: Bryan())
sim.delegate2 = LoggingMtgSimulator()
sim.simulate()
Topic:
Developer Tools & Services
SubTopic:
Swift Playground
Hello all!
I am currently facing an issue where I am receiving an "ios app products are only permitted in swift playground packages" error when trying to build the app. I forked a branch from the git repo that my friend made not too long ago, yet I still can't figure out what the issue was. I can provide the repo if needed.
Okay everyone who click into or just pass by this post ,to cut a farrrirly
long story short ,here is the thing...
I was devloping my app in the playground on my Mac , which was building for the iPad, In the early time of real machine commissioning(through the Xcode ),everything is okay everything is okay..
"well,mabe it's time to deploy my app to the playground in ipad"! Then,to top it all off🤣,then playground tell me
(In case that you can't understand chinese and creat ambiguity )
emm that's too tight...,so I can only got back to the Xcode changing my language version to swift 5
then.....
Noting change ....
and
I think err.. in order to properly deploy app to iPad
,I had to rework my code with swift 5!
So, I almost fell on my knees ,can somebody who in charge of the playground ,can somebody who in charge of the playground ,just ,just! shove swift 6 in the playground (as long as it make my code run anyway),
otherwise there's no way to debug it!
please please plase!
Topic:
Developer Tools & Services
SubTopic:
Swift Playground
Tags:
Swift Playground
Swans Quest
Playground Support
Swift Testing
When making a new Swift Playground via Xcode > New > Project > iOS > App Playground, as a .swiftpm package, the settings are very limited, including setting the minimum OS version.
This is incredibly irritating because I can't keep make @available blocks because that would double the size of my code, and I can't use SwiftData (for example) because my app needs to also support iOS 16.
Is there a way to set the minimum OS or some other upload type accepted for Apple so that I can change this simple setting?
Thank you
Topic:
Developer Tools & Services
SubTopic:
Swift Playground
Tags:
Swift Student Challenge
Swift Playground
Updated to iOS 18.2 beta 1 as soon as it was released on iPhone 15 pro max. playground icon on Home Screen but been waiting all this time and no activation. Dose anyone know if there is a known fault.
Hi Folks!
Just started again with playgrounds, and had my "Learn to code 1-2-3" Apps on old versions. Updated 1 and 2 to 5.8, and just found that Learn to code 3 was still on old version (3.1), so decided to delete it. I was hoping that normally I'll just find it where the others are for download (Learn to code & Build Apps), but it is not there.. it is not anywhere, cannot find it, and couldn't find a way to download from anywhere else. Any ideas? Maybe for Learn to code 3 there is no Swift 5.8 yet? Thanks!
Topic:
Developer Tools & Services
SubTopic:
Swift Playground
Hi apple I have been stuck for 2 days and it still does not work
Topic:
Developer Tools & Services
SubTopic:
Swift Playground
Tags:
Swift Playground
Playground Support
Hi,
First post and I am a total newbie when it comes to Ipads & Macs... And also this forum, so sorry if I post in wrong section.
My son use Ipad at school and they use Swift Playground there.
To be able to do some programming at home, I have set up Vmware with Sequoia 15.1.
I installed the app Swift Playground and try to run the playground Get Started with Code and some other education playgrounds.
If I understand correctly, it should be some landscape and a figure on the canvas... For me it is only a blue area.
I installed XCode, but could not figure out how to run the learning examples there. Tips? Is it possible to run the education playgrounds there?
I removed Swift Playgrounds and installed it again, same issue.
I also installed IOS 18.1 (?) but I am not sure it is needed.
Any suggestion of how I can get contents to show on the canvas? Except of bying an Ipad. ;)
Topic:
Developer Tools & Services
SubTopic:
Swift Playground
Tags:
Swift Playground
Playground Support
Bonjour, a chaque installation de swift playgrounds sur ipad, icloud empeche la sauvegarde et empeche donc d’ouvrir les app.
sur icloud drive les fichiers sont present mais a zero ko.
par contre les fichiers playgroundsbook fonctionnent.
la premiere solution que j’ai ***** etait de desactivé la sauvegarde icloud et ca a fonctionné en local.
mais comme je veux mes fichiers sur le icloud drive j’ai tenté une autre approche.
j’ai tenté de copié mes fichiers en local sur icloud drive ca ne fonctionne pas.
puis j’ai juste fait un drag/drop de fichier app vers le playgrounds.
l’app s’ouvre mais n’est pas sauvegardé dans icloud drive.
par contre les modifs sont bien enregistrées.
enfin j’ai refait la meme approche, une fois l’app ouverte dans playgrounds je l’ai partagé puis enregistré dans icloud.
cette fois ci le fichier est pris en compte et fonctionne.
Can someone help me with this please…
I have two apps which I have updated and have just tried uploading them to the Appstore.
This troubles me because I am paid up to date…
What is the best course of action for me to resolve this please?
I am trying to challenge myself by building an iPhone app in Swift Playgrounds. I just got a Mac Mini M4, so I am trying Swift Playgrounds for Mac.
I can submit a build to TestFlight, but it's for Mac and won't let me even test on my iPhone.
How can I build my app for iPhone?
The least "hacky" answer is appreciated, but I'll entertain anything. Examples in order of hackiness might be:
I missed an option in Playgrounds for Mac.
Open my playground in Xcode, change something, open back in Playgrounds for Mac.
Same as above, but maybe I have to add/copy a file (e.g., manifest.plist).
Open my playground in Playgrounds for iPad (I have an iPad 9), do something, copy back to Playgrounds for Mac.
Submit via Playgrounds for iPad.
Submit via Xcode.
BTW, I'm challenging myself not just for its own sake, but because I'm curious how far a student/newbie/etc can take Swift Playgrounds. I was hoping to set a good example for others looking for a lighter-resource, more user-friendly experience than Xcode (which is why I assume Playgrounds for Mac even exists). But right now it feels like Playgrounds for Mac is a … third-class citizen? Maybe the iPad version is second-class? I haven't really tried it.
P.S. Why does this text editor seem so lame? Making a numbered list and adding to it is a nightmare. Should be: start a numbered list, hit return, new number appears below. I'm on Safari. This should be the best dev experience on the planet, not the worst!
Estará disponible la app Swift para iPhone 15?
Will the Swift app for iPhone 15 be available?