---
title: "iOS create fillable PDF form | Nutrient SDK"
canonical_url: "https://www.nutrient.io/guides/ios/forms/form-creation/"
md_url: "https://www.nutrient.io/guides/ios/forms/form-creation.md"
last_updated: "2026-05-25T09:22:39.235Z"
description: "Nutrient supports programmatically creating and removing form fields from a document. This can be especially useful for adding digital signatures."
---

# Creating fillable PDF forms on iOS

Nutrient supports programmatically creating and removing form fields from a document. This can be especially useful for adding digital signatures. See the [add a signature form field](https://www.nutrient.io/guides/ios/forms/create-edit-and-remove/add-signature-field.md) guide to find out how to solve that particular use case.

A form field is a model representation of a visual form in a document. To be able to create a form field, you have to first create a form element (also known as a widget annotation). This works the same as adding any other annotation, as can be seen in the guide for [programmatically creating annotations](https://www.nutrient.io/../../annotations/programmatically-creating-annotations/), although you don’t need to explicitly add the annotation, as it’ll be added automatically when adding the form field. For more information on the difference between a form field and a form element, see our [what are forms?](https://www.nutrient.io/../introduction-to-forms/) guide.

Check out the API reference for more info about the [Forms API](https://www.nutrient.io/api/ios/documentation/pspdfkit/pdfformparser/forms).

## Adding radio buttons and checkboxes

A [`ButtonFormField`](https://www.nutrient.io/api/ios/documentation/pspdfkit/buttonformfield) with the type [`.radioButton`](https://www.nutrient.io/api/ios/documentation/pspdfkit/pdfformfield/kind/radiobutton) or [`.checkBox`](https://www.nutrient.io/api/ios/documentation/pspdfkit/pdfformfield/kind/checkbox) supports more than one form element. It also has an [`onState`](https://www.nutrient.io/api/ios/documentation/pspdfkit/buttonformelement/onstate) property, which represents the value when a button is checked. If it’s unchecked, the value is always set to `Off`:

```swift

// Create two radio buttons and position them in the document.
let radio1 = ButtonFormElement()
radio1.boundingBox = CGRect(x: 100, y: 100, width: 20, height: 20)
radio1.pageIndex = 0
let radio2 = ButtonFormElement()
radio2.boundingBox = CGRect(x: 130, y: 100, width: 20, height: 20)
radio2.pageIndex = 0

// The `buttonValues` specify the radio buttons' `onState` value.
let buttonValues = ["RadioButton1", "RadioButton2"]

let radioButtonFormField = try ButtonFormField.insertedButtonField(with:.radioButton, fullyQualifiedName: "RadioButton", documentProvider: documentProvider, formElements: [radio1, radio2], buttonValues: buttonValues)

```

### Adding a submit button

Here’s how to add a button to submit the current values of a form in XFDF format to an HTTP endpoint. Other available formats are FDF, HTML, or the whole PDF:

```swift

// Create the button form element (annotation).
let pushButtonElement = ButtonFormElement()
pushButtonElement.pageIndex = 0
pushButtonElement.boundingBox = CGRect(x: 100, y: 200, width: 150, height: 50)

// Just use a red fill so the button is visible. You may want to set up a custom appearance using the element’s `appearanceStreamGenerator`.
pushButtonElement.fillColor =.red

// Create the action and set the submission format to XFDF.
pushButtonElement.action = SubmitFormAction(url: URL(string: "https://example.com/wherever-you-want-to-send-the-form"), flags: [.XFDF])

// Ask Nutrient to create the form field and add it to the document. This will also add the form element to the document.
// The `fullyQualifiedName` must not be the same as an existing form field, but otherwise can be whatever you like.
// For a push button, there must be only one object in `formElements`.
// For a push button, the `buttonValues` can be empty since push buttons run an action rather than alter a value.
let pushButtonField = try ButtonFormField.insertedButtonField(with:.pushButton, fullyQualifiedName: "SubmitFormPushButton", documentProvider: documentProvider, formElements: [pushButtonElement], buttonValues: [])

```
---

## Related pages

- [Programmatically add signature fields to PDF forms](/guides/ios/forms/create-edit-and-remove/add-signature-field.md)
- [Form object model on iOS](/guides/ios/forms/create-edit-and-remove/form-object-model.md)
- [PDF form field editor on iOS](/guides/ios/forms/create-edit-and-remove/edit-fields.md)
- [PDF form field flags on iOS](/guides/ios/forms/create-edit-and-remove/form-field-flags.md)
- [How to disable PDF form editing on iOS devices](/guides/ios/forms/create-edit-and-remove/disable-editing.md)

