hopefully someone can guide me and help me out here!!
I'm retrieving some characters data from an API and I have stored the value in an IBOutlet
type of UITextView
named UITextDisplay
. All I'm trying to do is display 300 characters from that data or either less, but for some reason isn't letting me.
Thank you in advance!!
I also delegate the UITextField
to the ViewController
so it should work and my code compile perfectly fine. The
extension ViewController: UITextViewDelegate
{
func textView(_ textView: UITextView, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool
{
textView.text = UITextDisplay.text
let newText = (textView.text as NSString).replacingCharacters(in: range, with: text)
return newText.count < 300
}
}
Also.. is there any way to remove from the characters the end of it "+2637 characters"??
Look forward to any resolution! Amaury,