<!--
{
  "availability" : [
    "iOS: 14.0.0 -",
    "iPadOS: 14.0.0 -",
    "macCatalyst: 14.0.0 -",
    "tvOS: 14.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/UIApplicationDelegateAdaptor",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI28UIApplicationDelegateAdaptorV"
  },
  "title" : "UIApplicationDelegateAdaptor"
}
-->

# UIApplicationDelegateAdaptor

A property wrapper type that you use to create a UIKit app delegate.

```
@MainActor @preconcurrency @propertyWrapper struct UIApplicationDelegateAdaptor<DelegateType> where DelegateType : NSObject, DelegateType : UIApplicationDelegate
```

## Overview

To handle app delegate callbacks in an app that uses the
SwiftUI life cycle, define a type that conforms to the
<doc://com.apple.documentation/documentation/UIKit/UIApplicationDelegate>
protocol, and implement the delegate methods that you need. For example,
you can implement the
<doc://com.apple.documentation/documentation/UIKit/UIApplicationDelegate/application(_:didRegisterForRemoteNotificationsWithDeviceToken:)>
method to handle remote notification registration:

```
class MyAppDelegate: NSObject, UIApplicationDelegate, ObservableObject {
    func application(
        _ application: UIApplication,
        didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data
    ) {
        // Record the device token.
    }
}
```

Then use the `UIApplicationDelegateAdaptor` property wrapper inside your
[`App`](/documentation/SwiftUI/App) declaration to tell SwiftUI about the delegate type:

```
@main
struct MyApp: App {
    @UIApplicationDelegateAdaptor private var appDelegate: MyAppDelegate

    var body: some Scene { ... }
}
```

SwiftUI instantiates the delegate and calls the delegate’s
methods in response to life cycle events. Define the delegate adaptor
only in your [`App`](/documentation/SwiftUI/App) declaration, and only once for a given app. If
you declare it more than once, SwiftUI generates a runtime error.

If your app delegate conforms to the
<doc://com.apple.documentation/documentation/Combine/ObservableObject>
protocol, as in the example above, then SwiftUI puts the delegate it
creates into the [`Environment`](/documentation/SwiftUI/Environment). You can access the delegate from
any scene or view in your app using the [`EnvironmentObject`](/documentation/SwiftUI/EnvironmentObject) property
wrapper:

```
@EnvironmentObject private var appDelegate: MyAppDelegate
```

This enables you to use the dollar sign (`$`) prefix to get a binding to
published properties that you declare in the delegate. For more information,
see [`projectedValue`](/documentation/SwiftUI/UIApplicationDelegateAdaptor/projectedValue).

> Important: Manage an app’s life cycle events without using an app
> delegate whenever possible. For example, prefer to handle changes
> in ``doc://com.apple.SwiftUI/documentation/SwiftUI/ScenePhase`` instead of relying on delegate callbacks, like
> <doc://com.apple.documentation/documentation/UIKit/UIApplicationDelegate/application(_:didFinishLaunchingWithOptions:)>.

### Scene delegates

Some iOS apps define a
<doc://com.apple.documentation/documentation/UIKit/UIWindowSceneDelegate>
to handle scene-based events, like app shortcuts:

```
class MySceneDelegate: NSObject, UIWindowSceneDelegate, ObservableObject {
    func windowScene(
        _ windowScene: UIWindowScene,
        performActionFor shortcutItem: UIApplicationShortcutItem
    ) async -> Bool {
        // Do something with the shortcut...

        return true
    }
}
```

You can provide this kind of delegate to a SwiftUI app by returning the
scene delegate’s type from the
<doc://com.apple.documentation/documentation/UIKit/UIApplicationDelegate/application(_:configurationForConnecting:options:)>
method inside your app delegate:

```
extension MyAppDelegate {
    func application(
        _ application: UIApplication,
        configurationForConnecting connectingSceneSession: UISceneSession,
        options: UIScene.ConnectionOptions
    ) -> UISceneConfiguration {

        let configuration = UISceneConfiguration(
                                name: nil,
                                sessionRole: connectingSceneSession.role)
        if connectingSceneSession.role == .windowApplication {
            configuration.delegateClass = MySceneDelegate.self
        }
        return configuration
    }
}
```

When you configure the
<doc://com.apple.documentation/documentation/UIKit/UISceneConfiguration>
instance, you only need to indicate the delegate class, and not a scene
class or storyboard. SwiftUI creates and manages the delegate instance,
and sends it any relevant delegate callbacks.

As with the app delegate, if you make your scene delegate an observable
object, SwiftUI automatically puts it in the [`Environment`](/documentation/SwiftUI/Environment), from where
you can access it with the [`EnvironmentObject`](/documentation/SwiftUI/EnvironmentObject) property wrapper, and
create bindings to its published properties.

## Topics

### Creating a delegate adaptor

[`init(_:)`](/documentation/SwiftUI/UIApplicationDelegateAdaptor/init(_:))

Creates a UIKit app delegate adaptor using an observable delegate.

### Getting the delegate adaptor

[`projectedValue`](/documentation/SwiftUI/UIApplicationDelegateAdaptor/projectedValue)

A projection of the observed object that provides bindings to its
properties.

[`wrappedValue`](/documentation/SwiftUI/UIApplicationDelegateAdaptor/wrappedValue)

The underlying app delegate.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)