First of all, I think you should not use it right now. Because the documentation are very poor. And UITextPlaceholder also has no interesting information.
I have not found anything useful about the function. Maybe it is not ready yet.
You should use Placeholder in UITextView.
What does the function do?
I found that it creates an empty space at the beginning of the UITextView
with size
that you pass to it.
1) UITextField
(white field) without using insertTextPlaceholder
:

2) UITextField
with using insertTextPlaceholder
:

Warning
It causes crashes. For example, if you add this:
let placeholder = textView.insertTextPlaceholder(with: CGSize(width: 100, height: 40))
textView.insertText("Test")
And type something in UITextView
, you get this:
2020-04-29 14:20:10.264832+0300 StackOverflow[17081:284345] *
Terminating app due to uncaught exception 'NSRangeException', reason:
'* -[NSBigMutableString substringWithRange:]: Range {1,
18446744073709551615} out of bounds; string length 5'
*** First throw call stack: (...