I try to detect when carriage goes at new line in UITextView. I can detect it by comparison total later width with UITextView width:
CGSize size = [textView.
For Swift use this
previousRect = CGRectZero func textViewDidChange(textView: UITextView) { var pos = textView.endOfDocument var currentRect = textView.caretRectForPosition(pos) if(currentRect.origin.y > previousRect?.origin.y){ //new line reached, write your code } previousRect = currentRect }