Thanks @DTS Engineer for the suggestion and code!
In answer to the second part, I’m wanting to recreate a Pages/Word style document writing app that has custom rendering of the same body of text over multiple “pages“.
I’ve got a rough working prototype using custom TextKit2 drawing to views but implementing UITextInput manually is A LOT of work.
I was hoping instead to make use of UITextView given I only want to control the layout (drawing) of the fragments and essentially get the text editing experience for free.
But this has proved very difficult (there’s also almost no documentation on this topic other than 2 WWDC videos so it’s a much more difficult task).
I‘ve been able to achieve the above by using a UITextView (without subclassing) and using custom rendering but this draws the text on top of the UITextView in its multiple pages, duplicating the drawn text (not what I want as it effectively draws the UITextView’s text on a layer below as normal, then my text is rendered above it in separate page views, added as subviews to the UITextView)
So I thought perhaps the next step would be to subclass UITextView for more control.
Hopefully you can see what I’m trying to do, does that make sense?