SwiftyJD SwiftyJD - 4 months ago 10
Swift Question

How to programatcially add a line of space in between paragraphs in a UITextView?

I tried using /n after each paragraph like so:

"THE COZY, INVITING FEEL OF A CENTURIES-OLD EUROPEAN GATHERING SPOT INSPIRES THE PLACE.\n Creating a space from hand with dark wood interiors and eclectic old world accents, the husband and wife duo behind the Grail (as our loyalists, call us) brought a little bit of their ancestral heritage to design an authentic tavern amongst West Plano’s suburban landscape.\n


but this is what it looks like:

current

I am trying to make it look like this:

enter image description here

Any help is appreciated!

Answer

Using one more \n (i.e. \n\n) will have the effect you want:

textView.text = "THE COZY, INVITING FEEL OF A CENTURIES-OLD EUROPEAN GATHERING SPOT INSPIRES THE PLACE.\n\n Creating a space from hand with dark wood interiors and eclectic old world accents, the husband and wife duo behind the Grail (as our loyalists, call us) brought a little bit of their ancestral heritage to design an authentic tavern amongst West Plano’s suburban landscape.\n"
Comments