Hi everyone! I've been building Nogrammerly, a free, MIT-licensed writing assistant for the Mac (plus an iPhone keyboard) that works in almost any app and never sends text off the device: GitHub - gaurabh-pei/nogrammerly: The free, open-source, on-device Grammarly alternative for Mac and Windows. Spelling, grammar, tone checks and rewrites in Slack, Teams, Outlook, Mail & Zoom — powered by Apple Intelligence and Windows Phi Silica; your text never leaves your device. · GitHub
It underlines spelling, grammar and wordiness in the field you're typing in (Outlook, Safari, Chrome, TextEdit…), lets you fix things from a right-click menu with undo intact, and rewrites in a different tone using Apple's on-device model.
Some parts that might interest Swift folks:
- Accessibility API end to end. It reads the focused element, positions underlines with
AXBoundsForRangein a click-through overlay panel, and writes replacements back throughAXSelectedText, so ⌘Z keeps working. Electron apps needAXManualAccessibility. Chromium browsers ignore that and only build their tree onceAXEnhancedUserInterfaceis set, which reportskAXErrorNotImplementedbut works anyway. - Foundation Models without the macros. The project builds with only the Command Line Tools, where
@Generableisn't available, so structured proofreading output usesDynamicGenerationSchema. FoundationModels is weak-linked so the app still runs on macOS 14/15 with AI features off. - One engine, two platforms.
NogrammerlyCoreis a SwiftPM library shared by the AppKit app and an iOS keyboard extension that runs without Full Access. The keyboard can only delete and type, so applying a fix is a small edit-planning problem. - Harper as an LSP sidecar. The Mac app bundles a pinned, sha256-verified
harper-lsand talks to it over stdio, with Apple's checker as a fallback. - Tests use Swift Testing, including live tests against the real
harper-lsbinary.
Lessons that cost me time: ad-hoc signing silently breaks the Accessibility (TCC) grant on every rebuild because the grant is pinned to the cdhash. A self-signed identity fixes it. And never touch NSSpellChecker on a critical startup path at login, because its XPC timeout raises an Objective-C exception that AppKit swallows.
Issues labelled "good first issue" are open if anyone wants to dig in, and I'd love feedback on the AX and Foundation Models parts.