So dumb. If you're trying to use boundingRectForGlyphRange…
or lineFragmentRectForGlyphAtIndex…
on a UITextView's
NSLayoutManager, you will get slightly wrong coordinates if the text is longer than a few thousand characters.
…until you:
textView.layoutManager.allowsNonContiguousLayout = false
Then it works perfectly.