Inspiration

Many writing apps begin as pleasant blank pages and become complicated precisely when the work becomes serious. I wanted one calm, local-first workspace that keeps fast capture simple while supporting the structure, revision, linking, research, and export needs of a complete manuscript.

What it does

Margin is a native SwiftUI writing workspace for iPhone, iPad, and Mac Catalyst. Writers can capture prose, poetry, notes, screenplays, stage plays, comics, and webcomics; organize them in projects and sections; reorder a Binder; move between Corkboard and Outline views; link pieces with backlinks; search or replace across a project; and navigate with contextual Quick Open.

The editor supports Markdown-lite formatting, script elements, Typewriter Mode, Night Draft, margin notes anchored to passages, goals, deadlines, focus sessions, and protected revision history. More than 800 curated prompts, a Daily Spark widget, regional English options, and craft guidance help writers begin without generating prose for them.

Export Studio compiles a piece or complete Binder into text, Markdown, RTF, Word, HTML, PDF, Fountain, or Final Draft. Margin also imports common document formats and provides versioned JSON backups, safety copies, and private CloudKit sync.

How I built it

Margin uses SwiftUI, SwiftData, CloudKit, WidgetKit, and native document interchange. The same model and service layer supports iPhone, iPad, and Mac Catalyst. The current candidate passes 116 tests covering persistence, ordering, linking, formatting, revisions, backups, search, scripts, and import/export behavior.

I set the local-first philosophy, writing workflows, restrained visual direction, and the decision not to generate an author’s prose. Codex with GPT-5.6 served as the implementation partner across the adaptive architecture, Binder, editor, linked writing, revision system, backups, imports, export formats, widgets, and tests. It repeatedly built the real targets, diagnosed compiler and persistence failures, and refined cross-platform behavior from my product feedback.

Challenges

The hardest work was keeping one writing model coherent across several platforms and many document lifecycles. Reordering, backlinks, revision snapshots, project-wide replacement, CloudKit-compatible persistence, and multi-format export all touch the same source of truth. The app also needed to remain calm and approachable despite its breadth.

Accomplishments

Margin is a complete native product rather than a collection of editor demos. A writer can start with one line, grow it into a structured project, revise safely, and hand off a professional manuscript without leaving the app. The 116-test suite gives that breadth a meaningful verification layer.

What I learned

Codex works especially well when product judgment and automated verification reinforce each other. I could make high-level editorial and interaction decisions while Codex carried a change through models, services, adaptive UI, exports, and tests—then used failures to reveal assumptions that a visual prototype would miss.

What’s next

Next I would complete two-device CloudKit conflict testing, accessibility and physical-keyboard passes, export fixture comparisons against professional tools, and TestFlight feedback with novelists, poets, and scriptwriters.

Built With

  • cloudkit
  • codex
  • gpt-5.6
  • swift
  • swiftdata
  • swiftui
  • widgetkit
  • xcode
  • zipfoundation
Share this project:

Updates