---
title: XCUICoordinate
framework: xcuiautomation
role: symbol
role_heading: Class
path: xcuiautomation/xcuicoordinate
---

# XCUICoordinate

A location on screen relative to a UI element.

## Declaration

```swift
@MainActor class XCUICoordinate
```

## Overview

Overview Coordinates are dynamic, like the elements to which they refer, and may compute different screen locations at different times, or be invalid if the element they reference doesn’t exist.

## Topics

### Getting coordinate properties

- [referencedElement](xcuiautomation/xcuicoordinate/referencedelement.md)
- [screenPoint](xcuiautomation/xcuicoordinate/screenpoint.md)

### Moving the pointer

- [hover()](xcuiautomation/xcuicoordinate/hover().md)

### Clicking

- [click()](xcuiautomation/xcuicoordinate/click().md)
- [click(forDuration:thenDragTo:)](xcuiautomation/xcuicoordinate/click(forduration:thendragto:).md)
- [click(forDuration:thenDragTo:withVelocity:thenHoldForDuration:)](xcuiautomation/xcuicoordinate/click(forduration:thendragto:withvelocity:thenholdforduration:).md)
- [doubleClick()](xcuiautomation/xcuicoordinate/doubleclick().md)
- [rightClick()](xcuiautomation/xcuicoordinate/rightclick().md)

### Scrolling

- [scroll(byDeltaX:deltaY:)](xcuiautomation/xcuicoordinate/scroll(bydeltax:deltay:).md)

### Tapping and pressing

- [tap()](xcuiautomation/xcuicoordinate/tap().md)
- [doubleTap()](xcuiautomation/xcuicoordinate/doubletap().md)
- [press(forDuration:)](xcuiautomation/xcuicoordinate/press(forduration:).md)
- [press(forDuration:thenDragTo:)](xcuiautomation/xcuicoordinate/press(forduration:thendragto:).md)
- [press(forDuration:thenDragTo:withVelocity:thenHoldForDuration:)](xcuiautomation/xcuicoordinate/press(forduration:thendragto:withvelocity:thenholdforduration:).md)

### Performing gestures

- [swipeLeft()](xcuiautomation/xcuicoordinate/swipeleft().md)
- [swipeLeft(velocity:)](xcuiautomation/xcuicoordinate/swipeleft(velocity:).md)
- [swipeRight()](xcuiautomation/xcuicoordinate/swiperight().md)
- [swipeRight(velocity:)](xcuiautomation/xcuicoordinate/swiperight(velocity:).md)
- [swipeUp()](xcuiautomation/xcuicoordinate/swipeup().md)
- [swipeUp(velocity:)](xcuiautomation/xcuicoordinate/swipeup(velocity:).md)
- [swipeDown()](xcuiautomation/xcuicoordinate/swipedown().md)
- [swipeDown(velocity:)](xcuiautomation/xcuicoordinate/swipedown(velocity:).md)

### Creating relative coordinates

- [withOffset(_:)](xcuiautomation/xcuicoordinate/withoffset(_:).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)
- [NSCopying](foundation/nscopying.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)
- [Sendable](swift/sendable.md)

## See Also

### UI elements

- [XCUIElement](xcuiautomation/xcuielement.md)
- [XCUIElementAttributes](xcuiautomation/xcuielementattributes.md)
- [XCUIElementSnapshot](xcuiautomation/xcuielementsnapshot.md)
- [XCUIElementSnapshotProviding](xcuiautomation/xcuielementsnapshotproviding.md)
