<!--
{
  "availability" : [
    "macOS: 10.9.0 -",
    "swift: 4.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreFoundation",
  "identifier" : "/documentation/CoreFoundation/CGRect/frame(withWidth:using:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Core Foundation",
      "CoreFoundation"
    ],
    "preciseIdentifier" : "s:So6CGRectV6AppKitE5frame9withWidth5usingy14CoreFoundation7CGFloatV_So22NSCompositingOperationVtF"
  },
  "title" : "frame(withWidth:using:)"
}
-->

# frame(withWidth:using:)

Draws a frame around the inside of this rect in the current
NSGraphicsContext in the context’s fill color
The compositing operation of the fill defaults to the context’s
compositing operation, not necessarily using `.copy` like `NSFrameRect()`.

```
func frame(withWidth width: CGFloat = 1.0, using operation: NSCompositingOperation = NSGraphicsContext.current?.compositingOperation ?? .sourceOver)
```

## Discussion> precondition: There must be a set current NSGraphicsContext.

---

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)