Me porting Runestone from UIKit to AppKit.

Currently leaning towards having separate implementations of TextView for UIKit and AppKit with shared logic moved into separate types. The alternative is a single implementation with lots of if-else-endif macros.

It makes for some duplicated logic but also means that the two implementations can easily be maintained and implemented in isolation.

@simonbs I remember a WWDC talk from several years ago (from before Catalyst) about how Apple implemented Pages across iOS and macOS using the same code base. I can’t find it unfortunately, but I think they used used TextKit and text layers to implement all the juicy stuff with the actual NS/UIViews being super thin. Maybe the video is available in some dark corner of the web.