2

I'm currently setting a delegate on the layout manager and reacting to layoutManager(_:didCompleteLayoutFor:atEnd:), but there seems to be a slight delay between the layout being updated visually (by editing the text or resizing the NSTextView) and receiving the delegate callback.

This delay causes my UI to look out of sync. Below you can see an example where I add and remove a period twice, and then resize the window twice. In both cases you can see that the left side of the UI has a delayed reaction. This is because of the delay on layoutManager(_:didCompleteLayoutFor:atEnd:).

Example of the visible delay

Now clearly at least some layout information must be available sooner, because the NSTextView is updating immediately. Is there a way to get a more immediate callback on layout updates for an NSLayoutManager?

T .
  • 4,874
  • 3
  • 23
  • 36
  • Did you find a solution for this? You could `didChangeGeometryFrom` and call `ensureLayout` in there, but I found this to be slow. –  Dec 01 '19 at 11:14

0 Answers0