What problem does it solve?
macOS developers building apps with SwiftUI and AppKit often struggle with selecting appropriate architecture patterns, managing app lifecycle hooks, handling multi-window state, implementing dependency injection, and bridging between SwiftUI and AppKit components without introducing bugs or technical debt.
Core Features & Use Cases
- @Observable Architecture Patterns: Production-ready MV and MVVM implementations using the modern @Observable macro, with guidance on state ownership and AppKit automatic recomposition.
- NSDocument-Based Workflows: Complete patterns for document-based apps, including NSDocument subclassing, window controller management, autosave, and menu validation.
- Multi-Window State Management: Strategies for per-window state, window restoration, and avoiding shared state pitfalls across multiple windows.
- SwiftUI-AppKit Bridging: Recipes for integrating AppKit views in SwiftUI via NSViewRepresentable and embedding SwiftUI in AppKit via NSHostingController.
- Use Case: Build a professional document editing app with multiple inspector windows, proper undo/redo support, and testable dependency injection for analytics and printing services.
Quick Start
Use the swift-architecture-macos skill to implement a multi-window document-based macOS app with @Observable view models, NSDocument persistence, and environment-based dependency injection.