UITextView + TextKit 2: Are we allowed to configure our own custom rendering surface when using UITextView?

Hi TextKit 2 Team,

I'm trying to configure my own custom rendering surface when using UITextView(usingTextLayoutManager: true).

What I'm currently doing is adding a "contentLayer: CALayer" into my UITextView and adding my rendering surfaces into that.

The issue I'm running into, is that the rendering surface will display the first character I input, but then will not update for subsequent text until:

  • It becomes long enough to cause a line wrap.
  • I hit return.

Not sure if I'm doing something wrong? So my questions are:

  1. Is using configureRenderingSurface API intended to be used when I'm using UITextView? Or it's only meant for when I do fully custom InputView?
  2. Should I be inserting my rendering surfaces into my contentLayer or is there some more appropriate place for me to insert into?
  3. How do I properly trigger redraw or invalidation of my rendering surface on text editing changes? Is this a bug or do I have to trigger an update manually somewhere?

Many thanks in advance!

UITextView + TextKit 2: Are we allowed to configure our own custom rendering surface when using UITextView?
 
 
Q