Swift Playgrounds

RSS for tag

Learn and explore coding in Swift through interactive learning experiences on the Swift Playgrounds app for iPadOS and macOS.

Posts under Swift Playgrounds tag

94 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

Get Started with Apps Stuck in Playgrounds
The “Get Started with Apps” in Playgrounds looks great but it won’t allow me to advance to the next activity. It seems to think that my solution is incorrect, but what I did matches the solution provided in the “hint.” This could be corrected by either allowing for more variety in the responses, or by allowing the user to advance to the next activity regardless of whether the response they provided was correct.
10
2
2.6k
1w
Swift Playgrounds 4.1 keeps crashing when rerunning code
Try to learn some Swift coding but Playgrounds keeps crashing. I run Playgrounds 4.1 on latest Monterey 12.7.5, from a MacBook Air dated back 2017. Part of the error log says: Thread 9 Crashed:: Dispatch queue: com.apple.UIKit._UIViewServiceInterfaceConnectionRequest com.apple.PlaygroundsMac.ExecutionExtension The error can be reproduced by re-running the code; Everything goes well when the code was run at first time, but is doomed to fail at second run. Any help?
0
0
307
May ’24
Playgrounds
I've noticed Playgrounds crashing a lot lately, both on iPad and Mac. I have many Macs, Intel & M1, and 2 iPads, 7th Gen and 10.5" Pro. It's noticeably sluggish at the best of times progressively getting worse the last few updates, but worse than that it is hard crashing, losing data in the process. Anyone else seeing this? Not the end of the world, I'm a dev and use Xcode for anything substantial but I like to use Playgrounds on the iPad sometimes when I want to pop a quick idea down. I also plan to start creating playgrounds to help kids get into programming, so hoping this useful app isn't being neglected.
2
0
450
Apr ’24
How do you include custom symbol resources in a package?
I am trying to include custom symbol resources in a swift package for use in other projects. I have read the documentation here: https://developer.apple.com/documentation/xcode/bundling-resources-with-a-swift-package However there is no example code and I have created a very simple project to try and get this working but it does not. .target( name: "TestLibrary", resources: [.process("Resources/Media.xcassets")] ), This is in the Package.swift file and the path relative to the Package.swift file is Sources/TestLibrary/Resources/Media.xcassets. There's a GitHub project with an example custom SF Symbol SVG (but this may not be available in the future): https://github.com/kudit/TestLibrary Including this as a package in a blank Swift Playgrounds App project and just importing the TestLibrary and including TestImageView() in the ContentView technically works (it shows the system full star image, but none of the ways of rendering the test symbol as recommended works. It does work for a few of the options in the #Preview when viewing the project in Xcode. Anyone have any suggestions or know how to get the resources to be accessible from outside the module? I have tried both the .copy( option as well as the .process( option and neither seem to work.
1
0
472
Apr ’24
Playground can not create newbook / download sample playground after iCloud folder deletion, but it crashes
Hello All, I happen to remove "Playgrounds" folder from my iCloud drive, and afterwards Playground is no longer functioning but repeatedly crashes. It was okey before deletion, but now any operation to create or download playground then Playground App crashes all the time. Issue not resolved even creating same name folder by manual, Issue not resolved even re-install Playground - folder in iCloud will not created. I guess I need to fully uninstall PlayGround completely, then start from scratch to let Playground App to hold init step to generate required folder in iCloud, but not sure how to do it. Please give kind help if anyone knows about this issue, or if anyone knows complete deletion step of Playground. Best wishes, tons of thanks in advance. Best Regards, Issey Hamada
2
0
491
Mar ’24
NavigationPath(_items: SwiftUI.NavigationPath.(unknown context at
I tried to use navigationstack, and it works. but couldn't print the path, and with the message: " NavigationPath(_items: SwiftUI.NavigationPath.(unknown context at $7ff84b690a28).Representation.eager([SwiftUI.(unknown context at $7ff84b6907f0).CodableItemBox<Swift.String>]), subsequentItems: [], iterationIndex: 0). " `import SwiftUI var toDos: [String] = [ "list1", "list2", "list3" ] struct ContentView: View { @State private var path = NavigationPath() var body: some View { NavigationStack(path: $path) { List { ForEach(toDos, id:\.self) { toDo in Button(action: { path.append(toDo) print(path) }, label: { Text("go to " + toDo) }) } } .navigationDestination(for: String.self) { toDo in Text("page for " + toDo) } } } } #Preview { ContentView() }` I tried navigationlink and simulator still works fine, but cannot print anything of path
0
0
488
Mar ’24
App Download Size Nag Email - "Universal" device type
Whenever we submit a new release to the App Store we get a nag email from Apple that states, "The app binary listed below was 199.2 MB when you submitted it, but will be 223.9 MB once processed for the App Store. This exceeds the cellular network download size limit and may require your app to be downloaded over Wi-Fi." However, when I download the app from the App Store and have the Settings set to "Alway Ask" on my phone the alert shows 129 MB, which is matches up closely with what we see in the TestFlight metadata for all device types except "Universal". What is "Universal" device type in these days of thinning? And why is Apple apparently using that number to generate the nag email?
0
1
482
Mar ’24
CoreML in playgrounds
How do I add a already made CoreML model into my playground? I tried what people recommended online -- building a test project and get the .mlmodelc file and put that in the playground along with the autogenerated class for the model. However, I keep on getting so many errors. The errors: Unexpected duplicate tasks Target 'help' (project 'help') has write command with output /Users/cpulipaka/Library/Developer/Xcode/DerivedData/help-appuguzbduqvojfwkaxtnqkozecv/Build/Intermediates.noindex/Previews/help/Intermediates.noindex/help.build/Debug-iphonesimulator/help.build/adc7818afdf4ae03fd98cdd618954541.sb Target 'help' (project 'help') has write command with output /Users/cpulipaka/Library/Developer/Xcode/DerivedData/help-appuguzbduqvojfwkaxtnqkozecv/Build/Intermediates.noindex/Previews/help/Intermediates.noindex/help.build/Debug-iphonesimulator/help.build/adc7818afdf4ae03fd98cdd618954541.sb Unexpected duplicate tasks Showing Recent Issues Target 'help' (project 'help'): CoreMLModelCompile /Users/cpulipaka/Library/Developer/Xcode/DerivedData/help-appuguzbduqvojfwkaxtnqkozecv/Build/Intermediates.noindex/Previews/help/Products/Debug-iphonesimulator/help.app/ /Users/cpulipaka/Desktop/help.swiftpm/Resources/ZooClassifier.mlmodel Target 'help' (project 'help'): CoreMLModelCompile /Users/cpulipaka/Library/Developer/Xcode/DerivedData/help-appuguzbduqvojfwkaxtnqkozecv/Build/Intermediates.noindex/Previews/help/Products/Debug-iphonesimulator/help.app/ /Users/cpulipaka/Desktop/help.swiftpm/Resources/ZooClassifier.mlmodel ZooClassifier.mlmodel: No predominant language detected. Set COREML_CODEGEN_LANGUAGE to preferred language.
1
0
678
Feb ’24