<!--
{
  "availability" : [
    "iOS: 14.0.0 -",
    "iPadOS: 14.0.0 -",
    "macCatalyst: 14.0.0 -",
    "macOS: 11.0.0 -",
    "tvOS: 14.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 7.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/App/main()",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI3AppPAAE4mainyyFZ"
  },
  "title" : "main()"
}
-->

# main()

Initializes and runs the app.

```
@MainActor @preconcurrency static func main()
```

## Discussion

If you precede your [`App`](/documentation/SwiftUI/App) conformer’s declaration with the
[@main](https://docs.swift.org/swift-book/ReferenceManual/Attributes.html#ID626)
attribute, the system calls the conformer’s `main()` method to launch
the app. SwiftUI provides a
default implementation of the method that manages the launch process in
a platform-appropriate way.

---

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)