swiftxcodeuilabelnsparagraphstyleline-spacing

How to Increase Line spacing in UILabel in Swift 4


I want to increase the Line Spacing in UILabel but I can't figure it out how.

I found this solution [https://stackoverflow.com/a/39158698/8633963] on Stackoverflow but my Xcode always displays this:

Use of unresolved identifier 'NSParagraphStyleAttributeName'

I think the answer is right but it did not work for me. Can anyone help with this problem?


Solution

  • In Swift 4 in this case you have to use NSAttributedStringKey.paragraphStyle instead of NSParagraphStyleAttributeName