Im trying to give LineSpacing and LineHeight to my UILabel. I have an extension with two functions that both works individually. Cant get them to work together though.
extension UILabel {
func setText(text: String, lineSpacing: CGFloat) {
self.attributedText = NSAttributedString(string: text, attributes: lineSpacingAttribute(lineSpacing))
}
func setText(text:String, CharacterSpacing:CGFloat) {
let attributedString = NSMutableAttributedString(string: text)
attributedString.addAttribute(NSKernAttributeName, value: CharacterSpacing, range: NSMakeRange(0, text.characters.count))
self.attributedText = attributedString
}
}
The second function obviously overrides the first one when I do this:
ExampleLabel.setText(myTextString, withLineSpacing: 10)
ExampleLabel.setText(myTextString, CharacterSpacing: 10, lineSpacing: 10)
I've tried to merge these functions into one but I always end up with errors. Help please?