0

I have some text that user will be able to paste later on into UITextField. How can I copy that text programmatically?

Anton Tropashko
  • 4,982
  • 3
  • 36
  • 58

1 Answers1

1

By from jtbandes's Answer

  • To Copy
@IBAction fucn btnCopyClick(_ sender: UIButton)
{   
    UIPasteboard.general.string = YourTextField.text!
}
  • Paste
let contentText = UIPasteboard.general.string
steveSarsawa
  • 1,326
  • 2
  • 12
  • 29