I encountered the same problem,use:
textView.layoutManager.allowsNonContiguousLayout = false
I really don't understand why this is happening, it has been bothering me for too long!
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags: