RC RANDOM CHAOS

A native Apple dev's case for Electron when text is the product

· via Hacker News

Original source

Native all the way, until you need text

Hacker News →

A longtime macOS/iOS developer recounts trying to build something deceptively simple in pure Swift: a chat view with Markdown that lets users select an entire message. SwiftUI cannot do whole-document selection by design. NSTextView with TextKit 2 breaks the SwiftUI performance and testing work and spikes CPU under streamed input. NSCollectionView is mature but its cells blink unavoidably. Dropping to raw TextKit 2 fixes some things but loses integration with everything else, and reimplementing the small native behaviors users expect — context menus, dictionary lookup, accessibility, text interactions — turns into months of work.

WebKit-rendered Markdown ends up working well, and a throwaway Electron prototype works even better: solid typography, good performance, native integrations available, and rich features like Git diff rendering essentially free. The author’s conclusion is that for chat-style apps centered on long-form rich text, Apple’s native text stack has quietly become a liability rather than an advantage, which is why most modern chat apps lean on web tech.

The broader point for engineering leaders: the default reflex to mock Electron deserves a rethink when the product is text. SwiftUI and Swift remain strong for simple screens and perf-critical code, but the rendering and interaction model in WebKit-based stacks is now ahead where it matters most for this category of UI.

Read the full article

Continue reading at Hacker News →

This is an AI-generated summary. Read the original for the full story.