<!--
{
  "availability" : [
    "iOS: -",
    "iPadOS: -",
    "macCatalyst: -",
    "tvOS: -",
    "visionOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UIView/convert(_:from:)-7irzk",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)UIView(im)convertRect:fromView:"
  },
  "title" : "convert(_:from:)"
}
-->

# convert(_:from:)

Converts a rectangle from the coordinate system of another view to that of the receiver.

```
func convert(_ rect: CGRect, from view: UIView?) -> CGRect
```

## Parameters

`rect`

A rectangle specified in the local coordinate system (bounds) of `view`.

`view`

The view with `rect` in its coordinate system. If `view` is `nil`, this method instead converts from window base coordinates. Otherwise, both `view` and the receiver must belong to the same [`UIWindow`](/documentation/UIKit/UIWindow) object.

## Return Value

The converted rectangle.

## Discussion

---

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)