I'm facing an issue with Swift Playgrounds and files created in Xcode 16. It seems that Swift Playgrounds does not support Swift 6, but even when I create files specifically with Swift 5, Swift Playgrounds still reports that the files are unsupported.
This creates a significant problem because macOS Sequoia does not allow me to revert to Xcode 15, which might have offered better compatibility. As it stands, I can't find a solution to work seamlessly between Xcode and Swift Playgrounds.
Has anyone else encountered this issue? Are there any workarounds or updates planned to address this compatibility gap? Any advice would be greatly appreciated!
Swift Playgrounds
RSS for tagLearn and explore coding in Swift through interactive learning experiences on the Swift Playgrounds app for iPadOS and macOS.
Posts under Swift Playgrounds tag
84 Posts
Sort by:
Post
Replies
Boosts
Views
Activity
This is my code in ContentView:
import SwiftUI
import SceneKit
import PlaygroundSupport
struct ContentView: View {
var body: some View {
VStack {
Text("SceneKit with SwiftUI")
.font(.headline)
.padding()
SceneView(
scene: loadScene(),
options: [.autoenablesDefaultLighting, .allowsCameraControl]
)
.frame(width: 400, height: 400)
.border(Color.gray, width: 1)
}
}
}
func loadScene() -> SCNScene? {
if let fileURL = Bundle.main.url(forResource: "a", withExtension: "dae") {
do {
let scene = try SCNScene(url: fileURL, options: [
SCNSceneSource.LoadingOption.checkConsistency: true
])
print("Scene loaded successfully.")
return scene
} catch {
print("Error loading scene: \(error.localizedDescription)")
}
} else {
print("Error: Unable to locate a.dae in Resources.")
}
return nil
}
a.dae file exists in the Resources section of macOS Playground app. And a.dae can be viewed in Xcode.
Console shows: Error loading scene: The operation couldn’t be completed. (Foundation._GenericObjCError error 0.)
Any input is appreciated.
Following the official documentation, I'm trying to create a set of three localised Help Books.
The Help Books should be available in Spanish, English and Polish. Presently, I'm trying to complete English version.
App Structure
This is the plugin application consisting of main app and the plugin. The main app structure would looks as follows:
Files
. <XcodeProject Top>
├── Localizable.xcstrings
├── MyAppExtension
│ ├── MyAppExtension.swift
│ └── <other swift files>.swift
├──MyApp
│ ├── Info.plist
│ ├── +Array.swift
│ ├── +ButtonStyle.swift
│ ├── <other app swift files>.swift
├── Resources
└── MyApp.help
└── MyApp.help
└── Contents
├── Info.plist
└── Resources
├── English.lproj
│ ├── ExactMatch.plist
│ ├── InfoPlist.strings
│ ├── MyApp.helpindex
│ ├── MyApp.html
│ └── pgs
└── shrd
MyApp / MyApp.help / Info.plist file
Consists the following values:
Bundle name: MyApp
HPDBookAccessPath: MyApp.html
HPDBookTitle: My App Help
Default localization: en_gb
MyApp / Info.plist file
Contains the following entries:
Help Book directory name: MyApp.help
Help Book Identifier: MyApp Help
Build phase
The Copy Bundle Resources copies MyApp.help in MyApp/Resources.
Questions
Is the provided folder structure valid for creating a localised help books
Is there anything that is missing from across Info.plist files or is in the wrong places?
Why the MyApp -> Help opens the main help menu, not the app help
Hi everyone I am new to this community and I wanted to ask some help from you guys. I have zero knowledge about swift but I want to learn. Where can I start please help me. Thanks in advance.
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!
Hi, Could anyone share some insights on how to get and track the 3D coordinates of real objects in the environment in playgrounds? I searched for some resources and noticed ARKit, Reality may be helpful but not sure how to do it.
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 encountered a strange behavior that reminded me of when .sheet() modifiers didn't inherit environment objects. Unless I'm missing something very obvious, it seems to me that TableColumn may expose the same issue. At least on macOS, because the very same code does not crash on iOS.
I'm posting this here before reporting a SwiftUI bug.
Below is a gist for a playground:
https://gist.github.com/keeshux/4a963cdebb1b577b87b08660ce9d3364
I also observe inconsistent behavior when building with Xcode 16.1 or 15.4, specifically:
https://github.com/passepartoutvpn/passepartout/issues/872#issuecomment-2477687967
The workaround I resorted to is re-propagating the environment from the parent:
https://github.com/passepartoutvpn/passepartout/pull/873/files#diff-c662c4607f2adfd0d4e2c2a225e0351ba9c21dbdd5fc68f23bc1ce28a20bce4dR45
Hello Everyone,
I am completely new to programming, I have played with the Playgrounds app and I understand how some of the basic concepts work, however when going through "A Swift Tour" on developer.apple.com I struggle to understand a lot of the concepts presented.
Are there any resources that someone can recommend so I can continue to learn?
I tried just watching the video and searching the things I didn't understand, but I don't think I am learning much this way.
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. ;)
Hej hej
tl;dr. I have problems building a Playground App using Xcode Cloud and I created a reference repository to reproduce this. Did anyone try this before and succeeded? Maybe you have a hint about what's going wrong here.
Initial Failure
I followed the documentation for Building Swift packages and Swift Playgrounds app projects with Xcode Cloud and I have always run into the following error message:
❌ Code Signing
Exporting for App Store Distribution failed. Please download the logs artifact for more information
Check Logs
“Fair game!” I thought, checked out the logs and see this error appearing twice in each of the following steps:
Export archive for ad-hoc distribution
Export archive for development distribution
Export archive for app-store distribution
5.3 Sec.
Run command: 'xcodebuild -exportArchive -archivePath /Volumes/workspace/tmp/3546d064-74fa-42d0-8b36-3623e18941be.xcarchive -exportPath /Volumes/workspace/adhocexport -exportOptionsPlist /Volumes/workspace/ci/ad-hoc-exportoptions.plist '-DVTPortalRequest.Endpoint=http://172.16.35.199:8089' -DVTProvisioningIsManaged=YES -IDEDistributionLogDirectory=/Volumes/workspace/tmp/ad-hoc-export-archive-logs -DVTSkipCertificateValidityCheck=YES -DVTServicesLogLevel=3'
Error
Command exited with non-zero exit-code: 70
Moving forward, I downloaded the logs artifact as suggested earlier. This is IDEDistribution.standard.log:
2024-10-27 11:15:04 +0000 [MT] Starting export with options: {"embedOnDemandResourcesAssetPacksInBundle":true,"teamID":"38R2LLP8AF","stripSwiftSymbols":true,"thinning":"<none>","iCloudContainerEnvironment":"Development","destination":"export","reformatterBundleIdentifier":"hamburg.plus.encore","uploadSymbols":true,"raiseProfileSupportOptionalToRequired":false,"buildNumber":"4","testFlightInternalTestingOnly":false,"manageAppVersionAndBuildNumber":false,"method":"ad-hoc","generateAppStoreInformation":false}
This is IDEDistribution.critical.log (actually it's three times this single error, but I'll spare you the repetition):
2024-10-27 11:15:04 +0000 [MT] -[IDEDistributionMethodManager orderedDistributionMethodsForTask:archive:logAspect:]: Error = Error Domain=IDEDistributionMethodManagerErrorDomain Code=2 "Unknown Distribution Error" UserInfo={NSLocalizedDescription=Unknown Distribution Error}
And this is an excerpt (of hopefully relevant details) of IDEDistribution.verbose.log (again, this happens three times, only giving the relevant data points here):
…
2024-10-27 11:15:04 +0000 [MT] Rejected distribution method <IDEDistributionMethodiOSAdHoc: 0x600001590100> because it doesn't support distributing archive
…
2024-10-27 11:15:04 +0000 [MT] Rejected distribution method <IDEDistributionMethodiOSAppStoreValidation: 0x6000015900f0> because it doesn't support distributing archive
…
2024-10-27 11:15:04 +0000 [MT] Rejected distribution method <IDEDistributionMethodiOSAppStoreDistribution: 0x600001590120> because it doesn't support distributing archive
…
2024-10-27 11:15:04 +0000 [MT] Rejected distribution method <IDEDistributionMethodiOSAdHoc: 0x600001590100> because it doesn't support distributing archive
…
2024-10-27 11:15:04 +0000 [MT] Available distribution methods: {(
<IDEDistributionMethodSaveBuiltProducts: 0x6000015f8060>,
<IDEDistributionMethodExportArchive: 0x6000015f8070>
)}
Investigate Xcode Archive (*.xcarchive)
At this point, I downloaded the Xcode archive from AppStoreConnect and realized that it only contained debug symbols for the app, but not the app itself.
> ls -la /Users/herzi/Downloads/….xcarchive/Products
total 0
drwxrwxr-x@ 2 herzi staff 64 27 Okt 12:21 .
drwxrwxr-x@ 5 herzi staff 160 27 Okt 12:22 ..
Notice the absence of the Applications folder that would contain the Application.app bundle.
Current Status
So I created a clean, sample repository for my integration. Did anyone try this before and succeeded? Maybe you have a hint about what's going wrong here.
Hi apple I have been stuck for 2 days and it still does not work
why are people having problems with the playground download when some people have full access to it What is the difference between us and other people who have it
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
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!
I want to use Swift language to write code for drawing multiple polygons. I would like to find some examples as references. Can anyone provide example code or tell me where I can see such examples? Thank you!
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.
When I create a new iOS playground in Xcode 16.0 with an iOS 18.0 SDK installed, I cannot use some of the new features such as the new way for programming tab layouts. When I just use an Xcode project, these features work as expected. In a playground, I get errors saying "x is only available in iOS 18.0 and later". I have noticed this for more than just this feature. Is there some way I can force the playground to run with iOS 18 as I have the appropriate SDKs installed?
I would like to program an app in Swift Playground that displays WhatsApp Web in a webview, so to speak. But I keep seeing an error like in the screenshot.
My Code:
import SwiftUI
import WebKit
import PlaygroundSupport
struct WebView: UIViewRepresentable {
let url: URL
func makeUIView(context: Context) -> WKWebView {
let webView = WKWebView()
let request = URLRequest(url: url)
webView.load(request)
return webView
}
func updateUIView(_ webView: WKWebView, context: Context) {
}
}
struct ContentView: View {
var body: some View {
WebView(url: URL(string: "https://web.whatsapp.com")!)
.edgesIgnoringSafeArea(.all)
}
}
PlaygroundPage.current.setLiveView(ContentView())
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?