ios – UITextView causes abnormal number of gesture recognizer dependencies


I have a view that has several UITextViews, e.g.

var notesTextView: UITextView = {
    let textView = UITextView()
    textView.textColor = Colors.blackText
    textView.font = Fonts.body
    textView.isScrollEnabled = false
    textView.isEditable = false
    return textView
}()

I noticed that after navigating to this view and back a few times, I would increasingly get a warning that said “Abnormal number of gesture recognizer dependencies: 100” and would increment to 150, 200, etc, as I continued to navigate to the page and back.

On a whim, I replaced the text views with UILabels like so –

var notesTextView: UILabel = {
    let textView = UILabel()
    textView.textColor = Colors.blackText
    textView.font = Fonts.body
    textView.numberOfLines = -1
    return textView
}()

I now no longer get that warning, but I’ve lost the benefit of using UITextViews. Why was I getting that error? What can I do to prevent it and still use UITextViews?

Latest articles

spot_imgspot_img

Related articles

Leave a reply

Please enter your comment!
Please enter your name here

spot_imgspot_img