Education

RSS for tag

Teach students of all ages to code in Swift using a variety of resources in your curriculum.

Posts under Education tag

11 Posts

Post

Replies

Boosts

Views

Activity

Beginner Question - Local SPM Folder Structure
Hi there, I am working on an iOS mobile app, with a MVVM architecture and created an SPM folders for my DesignSystem, CoreKit, UnityBridge, and VoicePipeline. I added the packages locally, and dragged them into the project. Is working this way recommended? Or not? Should all the SPM folders I listed above be used this way, or should only some? New to this, unsure what is best. I do plan on sharing my code with other devs to work on. I thought this made sense, but if i did it the other way I was unsure how I would share the packages what is a best practice. Thanks so much!
1
0
78
Jul ’25
How to detect if an iPad is configured as a Shared iPad (Apple School Manager)?
I'm working on an iOS/iPadOS app and need to determine programmatically whether the device is a Shared iPad as configured through Apple School Manager (ASM). Shared iPads allow multiple users to sign in with Managed Apple IDs and are typically used in educational environments. I want to identify this configuration at runtime within my app. I’ve looked into UIDevice, NSProcessInfo, and MDM-related APIs but haven't found a reliable way to detect whether the current device is a Shared iPad. Is there an API or method to check if the current iPad is configured as a Shared iPad (via ASM)? Any guidance or code examples would be appreciated.
0
0
36
Jun ’25
New to Apple Developer Forums — Guidance Appreciated
Hi everyone 👋, I’m new to the Apple Developer Forums and just getting started with building apps for iOS/macOS. I’ve explored the documentation but wanted to introduce myself and ask for some advice from experienced developers. Currently working on: An iOS app using SwiftUI Learning more about integrating Sign in with Apple Exploring best practices for App Store submission Here’s what I’d like to know: What is the recommended approach to saving minimal app state before termination? Are there SwiftUI lifecycle metho18336114753ds or SceneDelegate hooks I should be aware of? Is UserDefaults the best tool for small state preservation in this context? Would love to hear from anyone who’s implemented sim18336114753ilar behavior — even a high-level suggestion would help. Thanks! Harjeet Singh
1
0
131
Jun ’25
Discussion on Location Services and Green light (Will someone deaf or blind ever know when their location was last on?)
Haptic or Sound queue to allow for the accessibility of the blind (sound) and deaf population (haptic) for even knowing when location services and the camera were last used? Also, the grey notification rather than the purple notification for location services should appear for the full 24 hours after an application has used the app, if the correct description is within the "copy" of Settings The green light lets them know that the application has changed to the camera and fade out orange light both could even have subtle simply click sounds, like a shutter, big haptic, softer sound, but editable in Settings, of course
2
1
182
May ’25
Crash when Mutating Array of Tuples with String Property from Multiple Threads
Hi Apple Developer Community, I'm facing a crash when updating an array of tuples from both a background thread and the main thread simultaneously. Here's a simplified version of the code in a macOS app using AppKit: class ViewController: NSViewController { var mainthreadButton = NSButton(title: "test", target: self, action: nil) var numbers = Array(repeating: (dim: Int, key: String)(0, "default"), count: 1000) override func viewDidLoad() { super.viewDidLoad() view.addSubview(mainthreadButton) mainthreadButton.translatesAutoresizingMaskIntoConstraints = false mainthreadButton.centerXAnchor.constraint(equalTo: view.centerXAnchor).isActive = true mainthreadButton.centerYAnchor.constraint(equalTo: view.centerYAnchor).isActive = true mainthreadButton.widthAnchor.constraint(equalToConstant: 100).isActive = true mainthreadButton.heightAnchor.constraint(equalToConstant: 100).isActive = true mainthreadButton.target = self mainthreadButton.action = #selector(arraytest(_:)) } @objc func arraytest(_ sender: NSButton) { print("array update started") // Background update DispatchQueue.global().async { for i in 0..<1000 { self.numbers[i].dim = i } } // Main thread update var sum = 0 for i in 0..<1000 { numbers[i].dim = i + 1 sum += numbers[i].dim print("test \(sum)") } mainthreadButton.title = "test = \(sum)" } } This results in a crash with the following message: malloc: double free for ptr 0x136040c00 malloc: *** set a breakpoint in malloc_error_break to debug What's interesting: This crash only happens when the tuple contains a String ((dim: Int, key: String)) If I change the tuple type to use two Int values ((dim: Int, key: Int)), the crash does not occur My Questions: Why does mutating an array of tuples containing a String crash when accessed from multiple threads? Why is the crash avoided when the tuple contains only primitive types like Int? Is there an underlying memory management issue with value types containing reference types like String? Any explanation about this behavior and best practices for thread-safe mutation of such arrays would be much appreciated. Thanks in advance!
1
0
97
Apr ’25
Any way to access the enterprise api as university students?
Hi, I am currently a Phd student from CMU working on a XR project with Vision Pro. I found the latest released enterprise APIs can be really helpful for our project, especially the configuration of the object tracking provider. However, I found a personal developer account can not access those APIs. And also it requires me to be a founder of the organization of the university when I try to update my account to an organization(CMU). I wonder is there any way to let the student still have a chance to try those fantastic APIs and some research based on them? I really need those functions and I believe what I am working on is also going to be a great demo of the Vision Pro. Thanks,
0
0
557
Nov ’24