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

Saved Image in document directory and save path in coredata not able to fetch the image file iOS swift