in a UItextView I am using paragraphStyle to space the new paragraphs between them.
let paragraphStyle = NSMutableParagraphStyle()
paragraphStyle.paragraphSpacing = 20
However, I would need to insert a new line without it being a new paragraph. Here is an example
Test first line.
Test new line.
Test new paragraph
I tried to use \r or to assign paragraphSpacing = 0 to the new line but it always distances it.
How could I go about inserting a new line without inserting a new paragraph? It's possible to do it?
You should set
paragraphStyle.spacing = 0for first line thenparagraphStyle.spacing = 20andparagraphStyle.spacing = 0for the third line. So basically spacing changes the space after the line it was set for not before.