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

Invalid bundle error while upload the app to the app Store

store cgpoint in userdefaults iOS swift