How to know which line of a TextView the user has tapped on
问题 I'm building an app that has a multi-line text editor (UITextView in UIKit, and TextEditor in SwiftUI). When the user tap on any line of the multi-line text, I should know which line is that, so I can print that line or do any other task. Is there a way to know which line of a UITextView the user has tapped on (using textViewDidChangeSelection delegate function or anything else)? I was thinking of storing the whole text in an Array (each line is an element), and updating the array