I am building a personal use plant location logging app as a Swift Playgrounds App project on iPad running iPadOS 26.0.1. I need Core Location access to record GPS coordinates. I have enabled the Core Location When in Use capability through the Swift Playgrounds app settings interface, but the permission prompt never appears when the app runs.
What I have set up:
I created a LocationManager class that conforms to CLLocationManagerDelegate. The manager is configured in init() with the delegate set to self and accuracy set to best:
class LocationManager: NSObject, ObservableObject, CLLocationManagerDelegate {
private let manager = CLLocationManager()
The LocationManager is instantiated as a @StateObject in a SwiftUI view. The requestPermission() method is called when the view appears:
.onAppear {
locationManager.requestPermission()
}
The problem:
When the app runs, no permission prompt appears. The app does not show up in Settings → Privacy & Security → Location Services at all. There are no compiler errors or runtime crashes. The permission request appears to be silently ignored.
What I have already tried and ruled out:
The Core Location When in Use capability is confirmed enabled in the Swift Playgrounds app settings. This is an App project, not a classic Playground. The app runs correctly otherwise — the SwiftUI views display and all non-location functionality works.
My question:
What is the correct way to request location permission in a Swift Playgrounds App project on iPadOS 26? Is there something specific to Swift Playgrounds or iPadOS 26 that requires a different approach than standard CLLocationManager authorization?
The following code works for me, when the app is given the ‘location when in use’ capability in the app settings.
I assume that your Swift Playgrounds app itself is allowed to use location services? (Edit: It seems that the Swift Playgrounds app doesn’t even have an option to turn it off).
The issue: The location permission prompt never appeared when requestWhenInUseAuthorization() was called from within a SwiftUI sheet (modal view). iOS silently ignores permission requests made from inside sheets.
The fix: Move the permission request to the parent view’s .onAppear modifier — before any sheet is presented. The LocationManager is created as a @StateObject in the main ContentView, requestPermission() is called in ContentView.onAppear, and the LocationManager instance is passed into the sheet view as an @ObservedObject.
Key points:
• The Core Location When in Use capability must be enabled in Swift Playgrounds app settings
• Use @StateObject in the parent view, @ObservedObject in the sheet
• Call requestWhenInUseAuthorization() from the main view, not from inside a sheet
• startUpdatingLocation() can still be called from within the sheet’s .onAppear