## Application Delegate
APNs requires an application delegate to handle push notifications functionality via delegate methods. If your app does not already have an application delegate, you will need to create one:
1. Create a class that subclasses `NSObject` and implements the `UIApplicationDelegate` (iOS/tvOS), `WKApplicationDelegate` (watchOS), or `NSApplicationDelegate` (macOS) protocol.
```swift
class AppDelegate: NSObject, UIApplicationDelegate {
}
```
```swift
class AppDelegate: NSObject, NSApplicationDelegate {
}
```
```swift
class AppDelegate: NSObject, WKApplicationDelegate {
}
```
2. Add a property to your main app struct that identifies your application delegate.
```swift
@main
struct App: App {
@UIApplicationDelegateAdaptor private var appDelegate: AppDelegate
// ...
}
```
```swift
@main
struct App: App {
@NSApplicationDelegateAdaptor private var appDelegate: AppDelegate
// ...
}
```
```swift
@main
struct App: App {
@WKApplicationDelegateAdaptor private var appDelegate: AppDelegate
// ...
}
```