<!--
{
  "availability" : [
    "watchOS: 7.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "WatchKit",
  "identifier" : "/documentation/WatchKit/WKApplicationMain(_:_:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "WatchKit"
    ],
    "preciseIdentifier" : "c:@F@WKApplicationMain"
  },
  "title" : "WKApplicationMain(_:_:_:)"
}
-->

# WKApplicationMain(_:_:_:)

Creates the application object and the application delegate, and sets up the app’s event cycle.

```
func WKApplicationMain(_ argc: Int32, _ argv: UnsafeMutablePointer<UnsafeMutablePointer<CChar>?>, _ applicationDelegateClassName: String?) -> Int32
```

## Parameters

`argc`

The count of arguments in `argv`. This is usually the corresponding parameter to `main`.

`argv`

A variable list of arguments. This is usually the corresponding parameter to `main`.

`applicationDelegateClassName`

The name of the app delegate’s class. This class must subclass <doc://com.apple.documentation/documentation/ObjectiveC/NSObject-swift.class> and adopt the [`WKApplicationDelegate`](/documentation/WatchKit/WKApplicationDelegate) protocol.

## Return Value

Even though this function specifies an integer return type, it never returns. When the user exits a watchOS app, the app moves to the background.

## Discussion

This function instantiates the application object and the specified delegate (if any), and then sets the delegate for the application. It also sets up the main event loop, including the application’s run loop, and begins processing events.

---

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)