---
title: XCUIScreen
framework: xcuiautomation
role: symbol
role_heading: Class
path: xcuiautomation/xcuiscreen
---

# XCUIScreen

A physical screen attached to a device.

## Declaration

```swift
@MainActor class XCUIScreen
```

## Overview

Overview Call the screenshot() method on an XCUIScreen instance to capture a screenshot of its current UI state. The XCUIScreenshotProviding protocol adds this method to XCUIScreen. You can take a screenshot of the current device’s main screen using the following code: let screenshot = XCUIScreen.main.screenshot() You can take a screenshot of every screen on the current device using the following code: let allScreenshots = XCUIScreen.screens.map { screen in     return screen.screenshot() }

## Topics

### Device screens

- [main](xcuiautomation/xcuiscreen/main.md)
- [screens](xcuiautomation/xcuiscreen/screens.md)

## Relationships

### Inherits From

- [NSObject](objectivec/nsobject-swift.class.md)

### Conforms To

- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)
- [Sendable](swift/sendable.md)
- [XCUIScreenshotProviding](xcuiautomation/xcuiscreenshotproviding.md)

## See Also

### Screenshots

- [XCUIScreenshot](xcuiautomation/xcuiscreenshot.md)
- [XCUIScreenshotProviding](xcuiautomation/xcuiscreenshotproviding.md)
