<!--
{
  "availability" : [
    "macCatalyst: 13.0.0 -",
    "macOS: 10.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSRectFromCGRect(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:@F@NSRectFromCGRect"
  },
  "title" : "NSRectFromCGRect(_:)"
}
-->

# NSRectFromCGRect(_:)

Returns an `NSRect` typecast from a `CGRect`.

```
func NSRectFromCGRect(_ cgrect: CGRect) -> NSRect
```

## Return Value

An `NSRect` typecast from a `CGRect`.

## See Also

[`func NSPointFromCGPoint(CGPoint) -> NSPoint`](/documentation/Foundation/NSPointFromCGPoint(_:))

Returns an `NSPoint` typecast from a `CGPoint`.

[`func NSSizeFromCGSize(CGSize) -> NSSize`](/documentation/Foundation/NSSizeFromCGSize(_:))

Returns an `NSSize` typecast from a `CGSize`.



---

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)