ObjC is so hard to read!!! Meanwhile…
After fighting with it for literal days I ended up setting it to just take an AttributedString and return a “UnionValue" thing that is like documented in one web page and a WWDC link, both with incorrect explanation of how it should be used.
It still doesn't work like I think it should but it works mostly OK and at this point I give up working on a feature 1% of users will ever touch.