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

Convert NsNumber, NSDate to String in iOS Swift

Global LocationManager Singleton class iOS Swift