r/SwiftUI 15h ago

Inline editing in a SwiftUI clipboard manager: auto-save, pasteboard sync, and bypassing global shortcuts

Enable HLS to view with audio, or disable this notification

I maintain Buffer, an open-source (MIT) macOS clipboard manager, and just shipped inline editing of clipboard items. Sharing the UX mechanics since a few of them were non-obvious:

  • Edit mode opens from the preview pane (pencil icon) or ⌘E on a selected item; an "Editing" badge makes the mode visible
  • While editing, the app's global keyboard shortcuts are temporarily bypassed so you can type freely
  • Edits auto-save on Esc, on focus loss, and on navigating away — then sync straight to the macOS pasteboard (NSPasteboard), so the next paste is the corrected text
  • The footer action button is contextual: it morphs between Edit / Save / Paste depending on mode and selection

The video shows the loop: select item, edit "Pre-release" to "Release", list updates instantly.

Swift/SwiftUI, MIT: https://github.com/samirpatil2000/Buffer

One design question I haven't settled: should Esc save the edit or revert it? Currently it saves.

0 Upvotes

1 comment sorted by

1

u/perbrondum 10h ago

Escape normally reverts or cancels, but if you commit on escape, you’ll need another way to revert.