Add asterisk symbol to label iOS swift
Solution:
Call the below function to label to set the asterisk symbol.
func addRequired() {
let passwordAttriburedString = NSMutableAttributedString(string: self.text ?? "")
let asterix = NSAttributedString(string: " *", attributes: [.foregroundColor: UIColor.red])
passwordAttriburedString.append(asterix)
self.attributedText = passwordAttriburedString
}
}
Comments
Post a Comment