<!--
{
  "availability" : [
    "macOS: 10.4.0 - 10.12.0"
  ],
  "documentType" : "symbol",
  "framework" : "PDFKit",
  "identifier" : "/documentation/PDFKit/PDFAnnotationTextWidget/setFieldName(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "PDFKit"
    ],
    "preciseIdentifier" : "c:objc(cs)PDFAnnotationTextWidget(im)setFieldName:"
  },
  "title" : "setFieldName(_:)"
}
-->

# setFieldName(_:)

Sets the internal field name for the annotation text field.

```
func setFieldName(_ name: String!)
```

## Parameters

`name`

The internal field name to be used for the annotation text field.

## Discussion

Field names are optional, internal names that identify text fields in a PDF form. You use field names with the [`PDFActionResetForm`](/documentation/PDFKit/PDFActionResetForm) action.

Note that multiple `PDFAnnotationTextWidget` objects with the same field name always have the same text associated with that field name. When text is entered into one of the objects, the text associated with that field name is changed in all objects. If you need to ensure unique text for a `PDFAnnotationTextWidget` object, you must give it a unique field name.

## See Also

[`PDFAnnotationTextWidget`](/documentation/PDFKit/PDFAnnotationTextWidget)

A `PDFAnnotationTextWidget` object allows you to manage the appearance and content of text fields.



---

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)