---
title: "CGRectGetMidX(_:)"
framework: coregraphics
role: symbol
role_heading: Function
path: "coregraphics/cgrectgetmidx(_:)"
---

# CGRectGetMidX(_:)

Returns the x- coordinate that establishes the center of a rectangle.

## Declaration

```swift
func CGRectGetMidX(_ rect: CGRect) -> CGFloat
```

## Parameters

- `rect`: The rectangle to examine.

## Return Value

Return Value The x-coordinate of the center of the specified rectangle.

## See Also

### Getting Min, Mid, and Max Values

- [CGRectGetMinX(_:)](coregraphics/cgrectgetminx(_:).md)
- [CGRectGetMinY(_:)](coregraphics/cgrectgetminy(_:).md)
- [CGRectGetMidY(_:)](coregraphics/cgrectgetmidy(_:).md)
- [CGRectGetMaxX(_:)](coregraphics/cgrectgetmaxx(_:).md)
- [CGRectGetMaxY(_:)](coregraphics/cgrectgetmaxy(_:).md)
