<!--
{
  "availability" : [
    "iOS: 11.0.0 -",
    "iPadOS: 11.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.12.0 -",
    "tvOS: 11.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "PDFKit",
  "identifier" : "/documentation/PDFKit/PDFAnnotation/setRect(_:forAnnotationKey:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "PDFKit"
    ],
    "preciseIdentifier" : "c:objc(cs)PDFAnnotation(im)setRect:forAnnotationKey:"
  },
  "title" : "setRect(_:forAnnotationKey:)"
}
-->

# setRect(_:forAnnotationKey:)

Sets a rectangle value in the annotation’s dictionary.

```
func setRect(_ value: NSRect, forAnnotationKey key: PDFAnnotationKey) -> Bool
```

## Parameters

`value`

The rectangle value to set in the annotation’s dictionary.

`key`

A [`PDFAnnotationKey`](/documentation/PDFKit/PDFAnnotationKey) or appropriate string from the Adobe PDF Specification.

## Return Value

<doc://com.apple.documentation/documentation/Swift/true> if the value sets successfully; otherwise, <doc://com.apple.documentation/documentation/Swift/false>.

## 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)