The Baffling Omission of Rich Text in SwiftUI

My hands tingle with anticipation as I climb the stairs to my office. Feels like first date jitters, I admit to myself, embarrassed. Today’s the day, today’s finally the day. This is no first date, I know, but I’m practically sprinting to my desk. After months of pleading, my boss finally caved and bought me a Macintosh, and promised to have it on my desk by morning.

Oh, there you are, hello my little friend. I’ve seen you on television but somehow you’re even smaller than I expected. I hurry to my chair and shuffle in close, spilling my coffee out of its Styrofoam takeout cup onto the instruction manual sitting on my desk. My fingers dance over the keyboard in a wave, like I imagine a pianist might do. Reaching around back, I flick the thumb sized power switch and even through the din of the office, I hear the computer hum to life. Across the miniature black and white television screen flickers a smile and I realize I’m looking at a face.

I rest my hand on the mouse and wiggle it around, watching the arrow on the screen. Look at it go. I click around a bit, feeling hamfisted. Suddenly I remember learning to hit a baseball, knowing in my mind but not in my body how to do it. Yet. I’ll get the hang of this, and for now I take a small pleasure in my left hand today feeling just as dumb as my right hand does every other day.

Finally, I manage to open a document. My eyes stare at the keyboard — through the keyboard — as my brain upturns every memory in search of long lost typewriting skills. The chickens formerly known as my index fingers peck at the keys beneath them, slowly and deliberately, and clobber out “Hello my name is Jason” in beautiful type. The greyscale screen looks like newsprint to me. I clutch the mouse, squeeze down its button, and slide it across the desk, streaking my sentence with a black highlight. Above it, I select a new font and see the text magically rewrite itself in a new script. Again. Again. Now one word at a time, each in a different font, my declaration looks more like a ransom note than a newspaper, but it’s a miracle nonetheless.

Like everyone, I’ve read about computers over the years. They seemed great for scientists, I guess, but I couldn’t be bothered with them. Until a friend of mine showed me this issue of Rolling Stone about some people at Xerox who put a whole damn print shop in a computer on your desk. Imagine that. To me, the most computers ever did was spit out giant reams of receipt paper. Not much to look at. But here were these computers that reminded me of my student newspaper job. Only you didn’t have to fiddle with lead type and get ink on your hands. These things were incredible, but cost about as much as a small house. Ah well, maybe some day!

And then one day I see the Macintosh and I think, that’s it. Everyone I know has to write things, and this little box is going to be the future. Everyone will have their own print shop on their desk. We’ve been chiselling in stone and somebody’s just handed us pen and paper. Only this thing lets you write like a newspaper. It can make things black or tilted, in different sizes, in different fonts. I bet one day, even in different colours.

Paging through the instruction manual, it suddenly dawns on me: I could make this manual with this computer, and this is obviously the future for everybody else, too. I can’t imagine it any other way.

~ ~ ~

This summer Apple revealed its new SwiftUI framework for creating rich user interfaces. And though the platform is brand new and just a starting point, I was quite surprised to find it doesn’t offer any rich text display or editing. You can style text with fonts and colours and the like, but the style applies to the whole run of text. There’s no equivalent components for creating a rich text editor in SwiftUI yet.

It will come, hopefully, but it’s a strange omission to me, given that rich text / desktop publishing is essentially the raison d’être of the personal computing industry and was the original backbone of the world wide web. Even though the world has largely moved on from printing paper documents, we still regularly read typographically rich documents all the time (e.g. web pages), and I’d love to see the legacy of personal computing devices, capable of creating such rich graphics, carry forward.

So SwiftUI developers, if you’re reading this, I implore you to expand your framework to support rich text editing. It’s a foundational, defining quality of graphical user interfaces, and it’s sorely missed. It may not change the world, but it certainly will make it nicer to read.

Join the Discussion 👂🤔✍️

Jim Dovey
There is a ray of hope: the Text view type supports the + operator, so you can do things like this:
Text("This is plain, but ") + Text("this is italic, ").italic() + Text("this is bold,").bold() + Text(" and ") + Text("this is both.").italic().bold()

Please read the Discussion Guidelines before replying.

☑️ Email me when someone replies.

Speed of Light