A dependency-free, Combine-free SwiftUI command palette (⌘K) for macOS and iPad — the
"jump to anything" overlay you get in VS Code, Raycast, or GitHub's cmd-k. It's an
action palette: each result carries a @MainActor action it runs when activated.
Pure SwiftUI (plus a little AppKit for one macOS keyboard fix), with built-in fuzzy matching, hardware-keyboard navigation on macOS and iPad, and sensible defaults so the zero-config call site stays short.
Swift Package Manager:
.package(url: "https://github.com/adamtheturtle/CommandPaletteKit", from: "0.1.0")Then add "CommandPaletteKit" to your target's dependencies.
import CommandPaletteKit
.sheet(isPresented: $showingPalette) {
CommandPaletteView {
[
PaletteResult(
id: "command.new",
title: "New Document",
subtitle: "Create a document",
category: "Command",
systemImage: "plus.square",
searchText: "New Document create"
) { createDocument() },
PaletteResult(
id: "nav.settings",
title: "Settings",
category: "Navigate",
systemImage: "gearshape"
) { openSettings() }
]
}
}Trigger it with the conventional ⌘K:
.keyboardShortcut("k", modifiers: .command)Full documentation — getting started, customization (custom rows, async candidates, styling, scoring), and keyboard navigation — is published with DocC:
📖 adamtheturtle.github.io/CommandPaletteKit
To browse it locally:
swift package --disable-sandbox preview-documentation --target CommandPaletteKitMIT. See LICENSE.