Skip to content

Instantly share code, notes, and snippets.

@oalansari82
Created May 27, 2018 19:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oalansari82/1af9a76086d916102cc925df93ff41cd to your computer and use it in GitHub Desktop.
Save oalansari82/1af9a76086d916102cc925df93ff41cd to your computer and use it in GitHub Desktop.
let attributedString = NSMutableAttributedString(string: "WhatEver text you want")
// *** Create instance of `NSMutableParagraphStyle`
let paragraphStyle = NSMutableParagraphStyle()
// *** set LineSpacing property in points ***
paragraphStyle.lineSpacing = 4 // Whatever line spacing you want in points
// *** Apply attribute to string ***
attributedString.addAttribute(NSAttributedStringKey.paragraphStyle, value: paragraphStyle, range: NSMakeRange(0, attributedString.length))
// *** Set Attributed String to your label ***
label.attributedText = attributedString
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment