'How to draw caret in the scroll view on iOS using system API?

I am working on an edit app, the view inherits from scroll view, and I draw most things manually. I need an insertion indicator, which may refer to caret(as I know windows use this term) or cursor(not the mouse cursor). I am not sure what term apple use.

I googled before and I know I can draw it as a line manually, or create a clear background text view over it, but I don't like these ways. I hope there are system APIs to do this, which is more native. Any one can figure out?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source