2025 Business & Education
WWDC25 · 25 min · Business & Education
Get to know the ManagedApp Framework
Discover how the ManagedApp framework helps your app adapt to managed environments. We’ll show you how to receive configuration data, manage app secrets securely, and tailor your app’s behavior based on organization-provided settings. We’ll also walk through real-world examples to show how you can build more flexible, manageable apps for enterprise and education environments.
Watch at developer.apple.com ↗Chapters
Code shown on screen · 3 snippets
Your app's managed configuration
// Your app's managed configuration
struct LandmarksManagedConfig: Decodable {
private(set) var collection: LandmarkCollection?
private enum CodingKeys: String, CodingKey {
case collection
}
init(from decoder: Decoder) throws {
let values = try decoder.container(keyedBy: CodingKeys.self)
collection = try values.decode(LandmarkCollection.self, forKey: .collection)
}
} Receiving the current configuration
// Receiving the current configuration
import ManagedApp
// [...]
var managedCollection: LandmarkCollection?
// [...]
func loadCollections() {
// [...]
Task {
let configProvider = ManagedAppConfigurationProvider()
for await config in await configProvider.configurations(LandmarksManagedConfig.self) {
// config's type is LandmarksManagedConfig?
managedCollection = config?.collection
} // Loops forever
}
} Using an identity
// Using an identity
final class MyURLSessionDelegate: NSObject, URLSessionDelegate {
func urlSession(_ session: URLSession,
didReceive challenge: URLAuthenticationChallenge)
async -> (URLSession.AuthChallengeDisposition, URLCredential?) {
switch challenge.protectionSpace.authenticationMethod {
case NSURLAuthenticationMethodClientCertificate:
// Look up the identity
let provider = ManagedAppIdentitiesProvider()
let id = "AssetDownloadClient"
guard let identity = try? await provider.identity(withIdentifier: id) else {
// No identity, cancel the challenge
return (.cancelAuthenticationChallenge, nil)
}
// Use the identity to authenticate.
return (.useCredential, URLCredential(identity: identity,
certificates: nil,
persistence: .forSession))
default:
return (.performDefaultHandling, nil)
}
}
} Resources
Related sessions
-
20 min