<!--
{
  "availability" : [
    "macOS: 11.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/NSApplicationDelegateAdaptor/init(_:)-1dott",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI28NSApplicationDelegateAdaptorVAA7Combine16ObservableObjectRzrlEyACyxGxmcfc"
  },
  "title" : "init(_:)"
}
-->

# init(_:)

Creates an AppKit app delegate adaptor using a delegate that’s
an observable object.

```
@MainActor @preconcurrency init(_ delegateType: DelegateType.Type = DelegateType.self)
```

## Parameters

`delegateType`

The type of application delegate that you
define in your app, which conforms to the
<doc://com.apple.documentation/documentation/AppKit/NSApplicationDelegate>
and
<doc://com.apple.documentation/documentation/Combine/ObservableObject>
protocols.

## Discussion

Call this initializer indirectly by creating a property with the
`NSApplicationDelegateAdaptor` property wrapper from inside your
`App` declaration:

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

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

SwiftUI initializes the delegate and manages its lifetime, calling it
as needed to handle application delegate callbacks.

SwiftUI invokes this method when your app delegate conforms to the
<doc://com.apple.documentation/documentation/Combine/ObservableObject>
protocol. In this case, SwiftUI automatically places the delegate in the
`Environment`. You can access such a delegate from any scene or
view in your app using the `EnvironmentObject` property wrapper:

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

If your delegate isn’t an observable object, SwiftUI invokes the
`init(_:)-67u91` initializer rather than this one, and doesn’t
put the delegate instance in the environment.

---

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)