im, используя метод ниже, чтобы напрямую добавить изображение в textview
let gif = UIImage.gif(name: emoji.name.replacingOccurrences(of: ".gif", with: ""))
let font = messageInputBar.inputTextView.font ?? UIFont.systemFont(ofSize: 16)
let attachment = NSTextAttachment()
attachment.image = gif
attachment.bounds = CGRect(x: 0, y: (font.capHeight - gifSize).rounded() / 2, width: gifSize, height: gifSize)
let attString = NSAttributedString(attachment: attachment)
messageInputBar.inputTextView.textStorage.insert(attString, at: messageInputBar.inputTextView.selectedRange.length)[![ft nste][1]][1]
Но я думаю, что nstextattachment не равен обычному тексту (как 'a', 'b' ...), потому что при добавлении изображения Я вижу, что текст-заполнитель все еще отображается. И курсор не меняется на положение, может кто поможет разобраться в этой проблеме?
вот текст-заполнитель

тогда вот результат, когда я добавляю только стикер (без текста), курсор всегда в первую очередь 