---
title: "convertToUserSpace(_:)"
framework: coregraphics
role: symbol
role_heading: Instance Method
path: "coregraphics/cgcontext/converttouserspace(_:)-1hk5r"
---

# convertToUserSpace(_:)

Returns a rectangle that is transformed from device space coordinate to user space coordinates.

## Declaration

```swift
func convertToUserSpace(_ rect: CGRect) -> CGRect
```

## Parameters

- `rect`: The rectangle, in device space coordinates, to transform.

## Return Value

Return Value The rectangle in user space coordinates.

## Discussion

Discussion In general, affine transforms do not preserve rectangles. As a result, this function returns the smallest rectangle that contains the transformed corner points of the rectangle.

## See Also

### Converting Between Coordinate Spaces

- [userSpaceToDeviceSpaceTransform](coregraphics/cgcontext/userspacetodevicespacetransform.md)
- [convertToDeviceSpace(_:)](coregraphics/cgcontext/converttodevicespace(_:)-53m7u.md)
- [convertToUserSpace(_:)](coregraphics/cgcontext/converttouserspace(_:)-3mtg3.md)
- [convertToDeviceSpace(_:)](coregraphics/cgcontext/converttodevicespace(_:)-91x5g.md)
- [convertToDeviceSpace(_:)](coregraphics/cgcontext/converttodevicespace(_:)-224h2.md)
- [convertToUserSpace(_:)](coregraphics/cgcontext/converttouserspace(_:)-693ur.md)
