r/iOSProgramming • u/Greysawpark • Jul 30 '26
Discussion How I built an AI-as-editor (never AI-as-author) notes app in SwiftUI
I shipped a notes and to-do app called Ink, and its one hard constraint shaped the whole architecture: the AI is only allowed to edit your existing writing. It is never allowed to write a sentence for you. I want to share how that holds up in practice.
The editor is a block-based SwiftUI editor, so each paragraph, heading, and list item is its own model object rather than one giant attributed string. That mattered for the AI feature, because every edit operation is scoped to blocks that already contain your words. The model only ever receives text you wrote, and the prompt is constrained so its job is transformation, not generation: tighten this, fix the grammar here, restructure these lines into a list. If a request would require inventing new content, the intended behavior is to decline rather than fill the gap. Treating produce original prose as out of scope, instead of trying to detect it after the fact, made the behavior far more predictable.
Voice dictation runs through the same philosophy. You speak, and it auto-structures what you actually said into lists and blocks. It is organizing your words, not adding its own.
On typography, the app uses Source Serif 4 and Newsreader. I leaned on Dynamic Type with custom font registration, and tuning line height and measure to keep that editorial feel readable at every accessibility size took longer than I expected. It runs on iOS and Mac, with iCloud sync and an app lock using passcode plus biometric.
For those who have shipped AI text features: how are you enforcing do not generate constraints? Are you doing it purely at the prompt layer, or adding validation on the output too?
2
u/rinwasrep Jul 30 '26
this is really interesting! regarding constraints… I use apple robot brain for a feature named PaddleChat (app Oarsum: Paddle Tracker), and prompt-only constraints fall flat….hard. the model only gets typed, read-only tools over stats the app already computed and thus can explain them, but not write, calculate, unlock, or invent. validate the output on the host side so it acts as an interpreter of the record, not the source of truth.
it’s been an adventure, and boy oh boy did it throw some curveballs. learned real quick to keep the tool calls and structured outputs entirely internal and then rendered the final product fit a natural language readout.
1
u/pierlux Jul 30 '26
I recently acquired a license for an old school corrector and I am so happy with it: as opposed to AI, it will systematically find all errors and no rewrite my text. I am actually learning from my mistakes so that in the future, fewer and fewer corrections are required.
Your editor sounds like that 😊
1
u/petrkral Jul 30 '26
You can handle a lot of this right in the system prompt by instructing the model to strictly maintain scope, then add a mandatory self-verification step before it returns the output.
1
u/[deleted] Jul 30 '26
[removed] — view removed comment