swift-architecture-macos

Implement macOS architecture patterns for SwiftUI and AppKit apps.

1|Updated Jun 5, 2026
One-click install
npx skills add https://github.com/LaughingJackalope/macos-skills --skill swift-architecture-macos
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: swift-architecture-macos
Source: https://github.com/LaughingJackalope/macos-skills/tree/main/swift-architecture-macos
Command: npx skills add https://github.com/LaughingJackalope/macos-skills --skill swift-architecture-macos

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

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.

Frequently Asked Questions about swift-architecture-macos

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I implement multi-window state synchronization in a macOS app using @Observable?

Multi-window state synchronization with @Observable requires careful state ownership strategies to avoid shared state pitfalls. You implement per-window state isolation and window restoration patterns to ensure independent window contexts while maintaining reactive updates.

What is the best way to bridge SwiftUI views with AppKit components?

Bridging SwiftUI with AppKit uses NSViewRepresentable to embed AppKit views in SwiftUI and NSHostingController to embed SwiftUI in AppKit. These patterns enable interoperability while maintaining architectural boundaries and preventing common integration bugs.

How do I manage app lifecycle and NSDocument workflows in SwiftUI macOS apps?

Managing NSDocument workflows involves subclassing NSDocument, handling window controller management, implementing autosave, and validating menus. You coordinate these with SwiftUI app lifecycle hooks to maintain production-grade document-based app architecture.

How does dependency injection work with @Observable in macOS app architecture?

Dependency injection with @Observable uses environment-based patterns to provide testable services like analytics and printing. You inject dependencies through the SwiftUI environment to maintain separation of concerns and support testing across view models.

Does this macOS architecture pattern support document editing apps with multiple inspector windows?

Yes, the architecture patterns explicitly support building professional document editing apps with multiple inspector windows, proper undo/redo support, and testable dependency injection. The recipes cover NSDocument persistence and multi-window state management.

What are common architectural pitfalls when developing macOS apps with SwiftUI and AppKit?

Common macOS architectural pitfalls include incorrect state ownership across multiple windows, improper AppKit automatic recomposition, and technical debt from poorly bridged SwiftUI-AppKit components. Production-ready patterns provide constraint documentation to avoid these issues.