Enabling the done button on a UITextView

Are you sure that you want to do that?

Steven Curtis
2 min readSep 3, 2019

The following post explains how to make sure you are “done” when the user has finished entering their text in a UITextView

Prerequisites:

  • Some understanding of coding in Swift, and adding components to the Storyboard (or through code)

Terminology

UITextView: An object that displays text in a custom style while supporting text editing

Implementation

When pressing the return button you want the keyboard to disappear.

You will need to make your ViewController conform to the UITextViewDelegate protocol; this will look something like:

Then implement the following within your View Controller

and of course tell your textView that the view controller is the delegate

--

--

No responses yet