I have one Uitextview
i have one code like this in Text String color Purple
let titleAttributes = [NSAttributedStringKey.font: UIFont.preferredFont(forTextStyle: UIFontTextStyle.headline), NSAttributedStringKey.foregroundColor: UIColor.purple]
let titleString = NSAttributedString(string: "Hello World", attributes: titleAttributes)
txtEditor.attributedText = titleString
after this code i want to write in (real time) with uitextview but in Black Color for example in this function i need to write
func textView(_ textView: UITextView, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool {
return true
}
How can i write in other color in continue of this textView