**Last updated**: 30 October 2025 | [**Change log**](/access/products/checkout/ios/changelog/)

# AccessCheckoutUITextField

Important
`AccessCheckoutUITextField` is an iOS UI component that wraps a `UITextField` for the purpose of entering card details. 

To ensure you remain SAQ-A compliant, we have designed the `AccessCheckoutUITextField` component to not publish any methods or properties that expose the text entered by the end user.

# Customization

You can customize your views using the following properties and methods supported by `AccessCheckoutUITextField`.

## Properties

In addition to the properties supported by the `UIView` class, here are the properties supported by `AccessCheckoutUITextField`:

| Properties | Type |
|  --- | --- |
| accessibilityHint | String |
| accessibilityIdentifier | String |
| accessibilityLabel | String |
| accessibilityLanguage | String |
| cornerRadius | CGFloat |
| borderColor | UIColor |
| borderWidth | CGFloat |
| textColor | UIColor? |
| font | UIFont? |
| textAlignment | NSTextAlignment? |
| placeholder | String? |
| attributedPlaceholder | NSAttributedString? |
| keyboardAppearance | UIKeyboardAppearance |
| isEnabled | Boolean |
| inputAccessoryView | UIView? |
| textContentType | UITextContentType? |


## Methods

In addition to the methods supported by the `UIView` class, here are the methods supported by `AccessCheckoutUITextField`:

| Methods |
|  --- |
| clear() |
| becomeFirstResponder():Boolean |
| resignFirstResponder():Boolean |
| setOnFocusChangedListener(listener: @escaping (AccessCheckoutUITextField, Bool) -> Void) |


# Handling onFocus events

`AccessCheckoutUITextField` has support for `onFocus` events, allowing your application to update the UI dynamically when your customer interacts with the `AccessCheckoutUITextField`.

You must use the `setOnFocusChangedListener` method to react to focus changes.

The example below changes the border of the `AccessCheckoutUITextField` when the field gains focus to blue and changes it back to gray when the field loses focus.


```swift
cvcTextField.setOnFocusChangedListener { view, hasFocus in
    view.borderColor = hasFocus ? .systemBlue : .systemGray
}
```

# Use XCUI for UI testing

`AccessCheckoutUITextField` acts as a wrapper around a `UITextField`. This is to ensure you can't access the `UITextField` and remain SAQ-A compliant.

Because of this, you must perform an action on the `UITextField` rather than on the `AccessCheckoutUITextField`.

You can access the `UITextField` by using the code below, where `your-identifier` corresponds to the id of the `AccessCheckoutUITextField`:


```
XCUIApplication().otherElements["your-identifier"].textFields.firstMatch
```