<!--
{
  "availability" : [
    "macOS: 10.7.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSView/convertToLayer(_:)-160pw",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSView(im)convertRectToLayer:"
  },
  "title" : "convertToLayer(_:)"
}
-->

# convertToLayer(_:)

Convert the size from the view’s interior coordinate system to the layer’s interior coordinate system.

```
func convertToLayer(_ rect: NSRect) -> NSRect
```

## Parameters

`rect`

A rectangle in the view’s interior coordinate system.

## Return Value

A rectangle in the layer’s interior coordinate system.

## Discussion

The layer’s space is virtual, and doesn’t take into account the layer’s <doc://com.apple.documentation/documentation/QuartzCore/CALayer/contentsScale> setting.

---

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)