---
title: "setFieldName(_:)"
framework: pdfkit
role: symbol
role_heading: Instance Method
path: "pdfkit/pdfannotationtextwidget/setfieldname(_:)"
---

# setFieldName(_:)

Sets the internal field name for the annotation text field.

## Declaration

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

## Parameters

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

## Discussion

Discussion Field names are optional, internal names that identify text fields in a PDF form. You use field names with the 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

### Related Documentation

- [PDFAnnotationTextWidget](pdfkit/pdfannotationtextwidget.md)

### Working with Field Names

- [fieldName()](pdfkit/pdfannotationtextwidget/fieldname().md)
