<!--
{
  "availability" : [
    "Xcode: 16.3.0 -",
    "iOS: -",
    "iPadOS: -",
    "macCatalyst: -",
    "macOS: -",
    "tvOS: -",
    "visionOS: -",
    "watchOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "XCUIAutomation",
  "identifier" : "/documentation/XCUIAutomation/XCUIApplication",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "XCUIAutomation"
    ],
    "preciseIdentifier" : "c:objc(cs)XCUIApplication"
  },
  "title" : "XCUIApplication"
}
-->

# XCUIApplication

A proxy that can launch, monitor, and terminate a test application.

```
@MainActor class XCUIApplication
```

## Overview

Use this class to launch, monitor, and terminate your app in a UI test. Use [`wait(for:timeout:)`](/documentation/XCUIAutomation/XCUIApplication/wait(for:timeout:)) to launch your app and wait for it to reach an expected state before you check test conditions.

## Topics

### Creating an application proxy

[`-  init`](/documentation/XCUIAutomation/XCUIApplication/init())

Creates a proxy for the application that’s configured as the Target Application in Xcode’s target settings.

[`+  new`](/documentation/XCUIAutomation/XCUIApplication/new)

Creates a proxy for the application specified as the Target Application in Xcode’s target settings.

[`-  initWithBundleIdentifier:`](/documentation/XCUIAutomation/XCUIApplication/init(bundleIdentifier:))

Creates a proxy for an application for the specified bundle identifier.

[`-  initWithURL:`](/documentation/XCUIAutomation/XCUIApplication/init(url:)-90e7z)

Creates a proxy for the application at the specified file system URL.

### Launching the application

[`-  launch`](/documentation/XCUIAutomation/XCUIApplication/launch())

Launches the application.

[`launchArguments`](/documentation/XCUIAutomation/XCUIApplication/launchArguments)

The arguments that pass to the application on launch.

[`launchEnvironment`](/documentation/XCUIAutomation/XCUIApplication/launchEnvironment)

The environment variables that pass to the application on launch.

[`-  openURL:`](/documentation/XCUIAutomation/XCUIApplication/open(_:))

Launches the application by URL.

### Activating the application

[`-  activate`](/documentation/XCUIAutomation/XCUIApplication/activate())

Activates the application.

### Terminating the application

[`-  terminate`](/documentation/XCUIAutomation/XCUIApplication/terminate())

Terminates any running instance of the application.

### Determining application state

[`state`](/documentation/XCUIAutomation/XCUIApplication/state-swift.property)

The most recent state of the application.

[`State`](/documentation/XCUIAutomation/XCUIApplication/State-swift.enum)

The possible states of an application during UI testing.

### Waiting for an application state

[`-  waitForState:timeout:`](/documentation/XCUIAutomation/XCUIApplication/wait(for:timeout:))

Waits for the application to reach the specified state or timeout.

### Resetting authorization status

[`-  resetAuthorizationStatusForResource:`](/documentation/XCUIAutomation/XCUIApplication/resetAuthorizationStatus(for:))

Resets the authorization status for a protected resource.

[`XCUIProtectedResource`](/documentation/XCUIAutomation/XCUIProtectedResource)

A system resource that requires user authorization to access.

### Performing an accessibility audit

[`performAccessibilityAudit(for:_:)`](/documentation/XCUIAutomation/XCUIApplication/performAccessibilityAudit(for:_:))

[`-  performAccessibilityAuditWithAuditTypes:issueHandler:error:`](/documentation/XCUIAutomation/XCUIApplication/performAccessibilityAuditWithAuditTypes:issueHandler:error:)

[`XCUIAccessibilityAuditType`](/documentation/XCUIAutomation/XCUIAccessibilityAuditType)

[`XCUIAccessibilityAuditIssue`](/documentation/XCUIAutomation/XCUIAccessibilityAuditIssue)

## Relationships

### Conforms To

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

[`XCUIElementAttributes`](/documentation/XCUIAutomation/XCUIElementAttributes)

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

[`XCUIScreenshotProviding`](/documentation/XCUIAutomation/XCUIScreenshotProviding)

[`XCUIElementTypeQueryProvider`](/documentation/XCUIAutomation/XCUIElementTypeQueryProvider)

[`Equatable`](/documentation/Swift/Equatable)

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

[`XCUIElementSnapshotProviding`](/documentation/XCUIAutomation/XCUIElementSnapshotProviding)

[`CVarArg`](/documentation/Swift/CVarArg)

[`Hashable`](/documentation/Swift/Hashable)

### Inherits From

[`XCUIElement`](/documentation/XCUIAutomation/XCUIElement)

---

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)