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

Popular posts from this blog

How to blink a button iOS swift?

iOS flutter while run to iPhone it had the error - Cannot find type 'PhoneNumberKit' in scope