Newline and / or carriage return in Swift String

I am trying to add Newline or Carriage return to UITextView.

    var text = UITextField()
    text.text = "This is a text \r\n This is a text"

      

The result shows all the text on one line:

This is the text This is the text

Can't draw new line or CR in UITextView? Or what am I missing here?

+3


source to share


1 answer


UITextField

is usually one-line and does not support multi-line text. Use insteadUITextView



+7


source







All Articles