<< All versions
Skill v1.0.0
currentLLM-judged scan90/100eriktobben/hermes-backup/swiftui-macos-utility-apps
──Details
PublishedOctober 23, 2026 at 12:35 PM
Content Hashsha256:bbe8327c442ef3b9...
Git SHAe3110c646c8c
──Files
Files (1 file, 3.8 KB)
SKILL.md3.8 KBactive
SKILL.md · 65 lines · 3.8 KB
version: "1.0.0" name: swiftui-macos-utility-apps description: Build and iterate small macOS SwiftUI utility apps with AppKit integrations for file picking, drag-drop, and batch processing. Use when implementing desktop tools that process local files, need progress UX, and require codec/format fallback behavior.
SwiftUI macOS Utility Apps
When to use
Use for macOS desktop utilities that combine SwiftUI UI with AppKit/FileManager/ImageIO workflows (batch converters, file processors, local automation tools).
Core workflow
- Model output capabilities explicitly
- Define an
OutputFormatenum with display name, extension, preferredUTType, and fallback format. - Keep fallback logic centralized in the conversion service (
resolvedFormat).
- Design conversion as a service, not in ViewModel
- Service owns file IO, destination generation, codec logic, and conversion loop.
- ViewModel owns state (
isConverting,conversionProgress, status/error text, selected files, results).
- Handle user file input from multiple paths
NSOpenPanelfor picking files.- SwiftUI
.onDropfor drag-and-drop (UTType.fileURL.identifier). - Deduplicate by canonical file path in ViewModel.
- Implement safe output writing
- Never overwrite silently.
- Generate unique destination names (
name.ext,name-2.ext,name-3.ext, ...).
- Expose progress from service to UI
- Add a progress callback in service (
(done, total, currentURL) -> Void). - Update
@Publishedprogress/status on@MainActor. - Show a
ProgressViewwhile converting.
- Show actionable results
- Return structured
ConversionResultincluding source, destination, original/output bytes. - UI shows total input/output plus per-file savings samples.
- Add quality presets without losing manual control
- Model presets as an enum (e.g.,
smallest,balanced,highest) withdisplayNameand numericqualityValue. - ViewModel method
applyQualityPreset(_:)sets slider quality and recomputes estimates. - When slider moves manually, snap preset selection to nearest preset (
syncPresetToClosestQuality) so UI state stays coherent.
- Improve post-conversion workflow
- Persist
lastOutputFolderin ViewModel after a successful run. - Auto-open output folder on success (
NSWorkspace.shared.open(folder)). - Also expose an explicit “Open Output Folder” button (disabled until a folder exists).
Pitfalls
- Codec support varies by macOS version/runtime: WebP/AVIF may not be universally writable. Always resolve to a supported fallback (typically JPEG) when
UTType/destination support is unavailable. - UI thread violations: service callbacks can run off-main-thread; bounce updates to
@MainActor. - Selection UX debt: include per-item removal and clear-all to avoid forcing users to restart selection.
- Build checks can be environment-limited: if
swiftCLI is missing, report verification as blocked and provide exact missing prerequisite. - Workspace path ambiguity: this environment can contain multiple similarly named trees (e.g.,
./SourcesandProjects/minify/Sources). Before patching files, confirm target repo root withsearch_files+git -C <path> statusand then use absolute/anchored paths.
Verification checklist
swift buildsucceeds (or report exact environment blocker).- Drag-drop imports files correctly.
- Duplicate filename outputs get suffixes instead of overwrite.
- Progress bar increments to 100% and status text updates per file.
- Unsupported requested output format falls back cleanly and still completes conversion.
References
- See
references/image-converter-patterns.mdfor concrete snippets and fallback patterns. - See
references/minify-quality-presets-and-output-folder.mdfor preset-sync and output-folder UX pattern, plus path-ambiguity guardrail.