I am trying to change the character spacing of uitextview. However it changes whole appearance. Screenshots:
Before adding the code
After adding the code
Code (as extension):
extension UITextView {
func addCharacterSpacing(kernValue: Double = 1.15) {
if let textValue = text, textValue.count > 0 {
let attributedString = NSMutableAttributedString(string: textValue)
attributedString.addAttribute(NSAttributedStringKey.kern, value: kernValue, range: NSRange(location: 0, length: attributedString.length - 1))
attributedText = attributedString
}
}
}