<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macCatalyst: 16.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UIPasteControl",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)UIPasteControl"
  },
  "title" : "UIPasteControl"
}
-->

# UIPasteControl

A button that a person taps to place pasteboard contents in your app.

```
@MainActor class UIPasteControl
```

## Overview

You can configure the button to appear as an icon, text, or both. The following button represents the icon and text option:

![A screenshot of a pill-shaped button with an icon of a paper sheet on top of a clipboard, and text that says Paste.](images/com.apple.uikit/media-4085675@2x.png)

In iOS 16 and later, programmatic pasting raises a user alert that prompts the user for approval before the app gains access to pasteboard contents (`UIPasteboard.general.string`). Use this class to paste without a user prompt.

### Add a paste button to a text view

The following code displays a paste button and assigns a text view as the recipient of pasteboard contents:

```swift
let textView = UITextView(frame: view.bounds)
view.addSubview(textView)

let configuration = UIPasteControl.Configuration()
configuration.baseBackgroundColor = .red
configuration.baseForegroundColor = .magenta
configuration.cornerStyle = .capsule
configuration.displayMode = .iconAndLabel
                    
let pasteButton = UIPasteControl(configuration: configuration)
pasteButton.frame = CGRect(x: view.bounds.width/2.0, y: view.bounds.height/2.0, width: 150, height: 60)
textView.addSubview(pasteButton)

pasteButton.target = textView
```

## Topics

### Creating a paste button

[`init(coder:)`](/documentation/UIKit/UIPasteControl/init(coder:))

Creates a paste button by deserializing the specified coder.

[`init(configuration:)`](/documentation/UIKit/UIPasteControl/init(configuration:))

Creates a paste button that conforms to the specified configuration.

[`init(frame:)`](/documentation/UIKit/UIPasteControl/init(frame:))

Creates a paste button with the specified size and position.

### Identifying the content recipient

[`target`](/documentation/UIKit/UIPasteControl/target)

The UI control that receives pasted content.

### Determining the button’s look

[`configuration`](/documentation/UIKit/UIPasteControl/configuration-swift.property)

An object that customizes the look of the paste button.

[`UIPasteControl.Configuration`](/documentation/UIKit/UIPasteControl/Configuration-swift.class)

An object that determines a paste button’s color, corner style, icon, and text.



---

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)