Hello fellow Techies!
I am currently doing the Swift Playgrounds “Keep Going with Apps” on my iPad Pro. Everything has been going as designed until I got to the ‘Add and Delete Creatures‘ module. The lesson concludes with being able to add a creature to your list in the CreatureZoo. When you run the app from the playground, you can fill out the fields and tap ‘Add’ and that is when the app dims and after 5 seconds I get the notification that the app has an unknown crash. I have reviewed the lessons leading up to it, but I can’t find anything wrong. (Full Disclosure: I really have no clue what I am looking at some of time.)
Has anyone else ran into this?
`import SwiftUI
import Guide
struct CreatureEditor: View {
//#-learning-code-snippet(defineVariablesCreatureEditor)
//#-learning-code-snippet(environmentValue)
@State var newCreature : Creature = Creature(name: "", emoji: "")
@EnvironmentObject var data : CreatureZoo
@Environment(.dismiss) var dismiss
var body: some View {
SPCAssessableGroup(view: self) {
VStack(alignment: .leading) {
Form {
Section("Name") {
//#-learning-code-snippet(addACreatureEditorTextField)
TextField("What is your monster's name?", text: $newCreature.name)
}
Section("Emoji") {
TextField("What does your monster look like?", text: $newCreature.emoji)
}
Section("Creature Preview") {
CreatureRow(creature: newCreature)
}
}
}
.toolbar {
ToolbarItem {
Button("Add") {
data.creatures.append(newCreature)
dismiss()
}
}
}
//#-learning-code-snippet(addButtonToToolbar)
}
}
}
struct CreatureEditor_Previews: PreviewProvider {
static var previews: some View {
NavigationStack() {
CreatureEditor().environmentObject(CreatureZoo())
}
}
}’
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
] TODO Item
Item 1
Item 2
linkText
TODO Item language
After updating playgroud to the latest 4.6.3 version, the original sample app download interface disappeared. I tried many methods but couldn't find it again. How should I retrieve it again? Or was it deleted in this version?
Topic:
Developer Tools & Services
SubTopic:
Swift Playground
Hi everyone,
I’ve been developing an app using Swift Playgrounds, and it was working fine in version 4.5.
However, after updating to Swift Playground 4.6, the app no longer runs.
After some testing, I found that the issue occurs when import AppIntent is included.
Here’s a simple example:
import SwiftUI
//import AppIntents // <- If this line is included, Preview and Run fail.
@main
struct MyApp: App {
var body: some Scene {
WindowGroup {
Image(systemName: "globe")
.imageScale(.large)
.foregroundColor(.accentColor)
Text("Hello, world!")
}
}
}
Has anyone else encountered this issue?
Thanks!
I’m looking to publish an app I’ve written on my iPad (Air, to be exact), but I can’t make a screenshot at the required size (which is Pro). And yes, I don’t have a Mac (yeah, I know).
Is there an easy or simple way to get a screenshot of an app if I don’t have the right hardware? Is this something I could scale/resize from a smaller device? Or, could I just include a portion of the actual screenshot in a picture (with the correct dimension) that has other text/information?
any help would be greatly appreciated
Topic:
Developer Tools & Services
SubTopic:
Swift Playground
I had several library projects that were working in Swift Playgrounds < 4.6 but I get several duplicate compilation errors and previews will not build in Swift Playgrounds > 4.6. Does anyone know how to fix this issue?
Example project:
This project builds and runs fine under Swift Playgrounds 4.5.1 however it will not run complaining multiple commands produce generated output files under Swift Playgrounds 4.6.1, 4.6.2, and 4.6.3.
https://github.com/kudit/Compatibility
Download this repository and add the extension ".swiftpm" to the folder and double click to open in Swift Playgrounds. If running on earlier Swift Playgrounds you can see there are no errors and previews work great (on both macOS and iPadOS versions of Swift Playgrounds 4.5.x). However, on Swift Playgrounds 4.6.x, previews will not display.
Are embedded libraries not support anymore? This would be very disappointing.
I posted this as a Feedback weeks ago with no response: FB16509699
Topic:
Developer Tools & Services
SubTopic:
Swift Playground
Tags:
Swift Packages
Swift Playground
Playground Support
I developed my app on xcode, and it builds fine for xcode on simulator. However, when I transferred the swiftpm file to my ipad, the playground failed to build with only the error message "Build failed", while preview on playgrounds works fine.
I am not sure what the cause of the error is, if anyone has any tips that would be greatly appreciated. Thank you.
In Swift Playground 4.6.2 the package PlaygroundSupport is no longer available to Playground apps. The following test previously permitted apps run in the Playground vs compiled in XCode to support different behavior:
#if canImport(PlaygroundSupport)
container = NSPersistentContainer(name: "myApp", managedObjectModel: Self.createModel())
#else
container = NSPersistentCloudKitContainer(name: "myApp")
#endif
Since Swift Playground 4.6.2 the PlaygroundSupport package is no longer available for app projects in Playgrounds.
Is there a different compile type test which can be used to differentiate compilation for Swift Playground apps ?
I am currently having to use a runtime workaround (below) but would prefer a compile time test is an alternative is available.
public static var inPlayground: Bool {
if Bundle.allBundles.contains(where: { ($0.bundleIdentifier ?? "").contains("swift-playgrounds") }) {
return true
} else {
return false
}
}
Topic:
Developer Tools & Services
SubTopic:
Swift Playground
Tags:
Developer Tools
Swift Playground
Playground Support
I'm trying to add Assets.xcassets to a .swiftpm project, but I'm getting the warning:
⚠️ Ignoring duplicate build file in build source build phase
(Just to know, that is about developing in XCODE, in Swift Playgrounds does not appear it, even in this second being harder to setting up)
The problem is that there are no “Build Phases” in XCODE to remove duplicate files manually.
I've already tried adding the path of Assets.xcassets in the resources property of Package.swift, like:
.executableTarget(
name: "AppModule",
path: ".",
resources: [
.process("Assets.xcassets")
]
)
Even so, the warning persists. Does anyone know how to solve this? Is there any way to remove duplicate references or force a cleanup of the Swift Package Manager cache to fix it?
I appreciate any tips! 🙏🚀
Topic:
Developer Tools & Services
SubTopic:
Swift Playground
Tags:
Swift Student Challenge
Swift
Swift Playground
Xcode
With iOS 18.3.1 in Playground there is a different view in TabView: in Preview the systemImage are visible and the TabView is visible under, instead launching the app the systemImage it is no longer visible. How can I solve it? Thank you
I’ve encountered a bug in Swift Playgrounds within “Learn to Code 2”, specifically in the “Variables: Seeking Seven Gems” section. No matter what I do—or even if I do nothing at all—an error always occurs.
I’ve tested this on both an iPad (9th generation) and an iPad Pro 11-inch (4th generation), and the issue happens on both devices.
Has anyone else experienced this? Any ideas on how to fix or work around it?
Thanks!
I used Swift Playground to develop application in Mac OS. Also using ZStack I used limited area in full page (using .frame(width: $, height: $)). However using command + R or clicking start button to see preview .app, while non resizing application my ZStack show as cutted. Please tell me how to set preview .app frame size as width, height... The buttom code is ContentView.swift code.
@main
struct ContentView: App {
init() {
MyFont.registerFonts()
}
// @StateObject private var audioPlayer = AudioPlayer()
var body: some Scene {
WindowGroup {
NavigationStack {
StartMenuView()
.frame(minWidth: 594, maxWidth: 594,
minHeight: 1142, maxHeight: 1142)
.preferredColorScheme(.dark) // Dark Mod
.statusBar(hidden: true) // Hidden Status Bar
.edgesIgnoringSafeArea(.all) // Ignoring Safe Area
}
}
.windowResizability(.contentSize)
}
}
Thank you for reading.


Topic:
Developer Tools & Services
SubTopic:
Swift Playground
Tags:
Swift
App Review
Swift Playground
Hello folks,
I'd like to report a bug in Swift Playground to Apple official dev team, it's in "Learn to Code 2" - "Seeking Seven Gems".
The puzzle map can't be loaded, please check the following screenshot,
My system environment:
MacOS 15.3
Swift 6.0.3 (swift-driver version: 1.115.1 Apple Swift version 6.0.3 (swiftlang-6.0.3.1.10 clang-1600.0.30.1))
Swift Playground 4.6.2
Xcode 16.2
Hardware: MacBook Pro/M2 Pro/32G
Topic:
Developer Tools & Services
SubTopic:
Swift Playground
Tags:
Developer Tools
Swift Student Challenge
Swift
Hello! I have asked this question in previous years, but I want to make sure I can be safe as each challenge could be different.
Are applicants for the Swift Student Challenge allowed to use the features and technologies involved with Metal/MetalKit? Last year, the answer was yes. I have seen a few people here and there use it with Swift and won.
I would like to know if we can use it for the 2025 challenge for this year as well.
Thanks! :)
Topic:
Developer Tools & Services
SubTopic:
Swift Playground
Tags:
Swift Student Challenge
Metal
MetalKit
Fatal Error in Swift Playground
Description
I'm experiencing a catastrophic error when importing Package Dependency in any Swift Playgrounds that has icon or name that caused the whole Playground won't work anymore with error messages below.
I'm current running macOS Sequoia 15.3 (24D60) and Swift Playgrounds 4.6.1. They're all up-to-date.
Reproduction
Open Swift Playgrounds and and create a new project.
Import a package dependency
https://github.com/simibac/ConfettiSwiftUI.git
Rename the project and add an icon
Then you should able the reproduce the problem. I strongly believed that this is a serious bug.
You'll find that Assets in the left column are disappeared and appeared Assets.xcassets, you're unable to reveal the Dependency in the column like the reference picture above. The whole Playground is destroyed now and unable to work anymore.
Topic:
Developer Tools & Services
SubTopic:
Swift Playground
Tags:
Swift Packages
Swift
Swift Playground
I'm unable to rename my Swift Playground or add/change the app icon when I imported a package dependency after upgraded my Swift Playgrounds App to the newest version. Every time I tried to do that, the whole project will be destroyed and showed error message below.
I wonder if anyone have same experience with me or someone can tell me the solution, it terrifies me and I'm worried that I'll be unable to submit my project on time because of that.
I have created a model folder and some swift files that are contained inside the folder. I change the file names to reflect structure or content and when I close the project and reopen it the file names revert to "New File"
I am using Swift Playgrounds on Mac. Not Xcode Playgrounds
Hi, I encountered an issue after the latest update on Swift Playground.
I’m using the iPad Pro 3rd Gen, first time reporting a bug hopefully I’m on the right platform.
When I create a new Swift file or folder, it’ll auto revert the file/folder name to the default naming upon creation.
Tested this one on a few existing projects, it’s the same for all of them.
Initially when I created a new project to verify, those files/folders can be renamed without the issue of reverting.
But after testing it again, seems like the same issue is happening to it as well.
I‘ve tried restarting my iPad but the problem persists.
So I thought to report it and from my search seems like this is the platform for it? Thanks.
My M2 Pro Mac mini with OSX 14.7 just updated to Swift Playgrounds 4.6.1. Now the :Learn to Code & Build Apps screen is limited in size and can't be zoomed. There is no way to scroll horizontally and I can't view the whole screen.
Hey, meanwhile it's a great thing to program apps on the iPad and to be able to load them into the App Store Connect and the App Store.
What about localization in the meantime? When I open the folder en.lproj in sample apps from XCode, then there are two files stored in it:
Glossary.plist (XML) and
Localizable.strings (binary)
Is it correct that XCode creates binary files from the strings? Otherwise, Swift Playgrounds already offers localization in the localized learning content, but i guess the binary files can only be created in XCode?