Instance Method

textViewShouldBeginEditing(_:)

Asks the delegate if editing should begin in the specified text view.

Declaration

optional func textViewShouldBeginEditing(_ textView: UITextView) -> Bool

Parameters

textView

The text view for which editing is about to begin.

Return Value

true if an editing session should be initiated; otherwise, false to disallow editing.

Discussion

When the user performs an action that would normally initiate an editing session, the text view calls this method first to see if editing should actually proceed. In most circumstances, you would simply return true from this method to allow editing to proceed.

Implementation of this method by the delegate is optional. If it is not present, editing proceeds as if this method had returned true.

See Also

Responding to Editing Notifications

func textViewDidBeginEditing(UITextView)

Tells the delegate that editing of the specified text view has begun.

func textViewShouldEndEditing(UITextView) -> Bool

Asks the delegate if editing should stop in the specified text view.

func textViewDidEndEditing(UITextView)

Tells the delegate that editing of the specified text view has ended.