
Description
Bridge macOS SwiftUI into AppKit narrowly. Use when implementing representables, reaching NSWindow or panels, handling menus, or using the responder chain.
SKILL.md
AppKit Interop
Quick Start
Use this skill when SwiftUI is close but not quite enough for native macOS behavior. Keep the bridge as small and explicit as possible. SwiftUI should usually remain the source of truth, while AppKit handles the imperative edge.
Choose The Smallest Bridge
- Use pure SwiftUI when the required behavior already exists in scenes, toolbars, commands, inspectors, or standard controls.
- Use
NSViewRepresentablewhen you need a specific AppKit view with lightweight lifecycle needs. - Use
NSViewControllerRepresentablewhen you need controller lifecycle, delegation, or presentation coordination. - Use direct AppKit window or app hooks when you need
NSWindow, responder-chain, menu validation, panels, or app-level behavior.
Workflow
- Name the capability gap precisely.
- Window behavior
- Text system behavior
- Menu validation
- Drag and drop
- File open/save panels
- First responder control
- Pick the smallest boundary that solves it.
- Avoid porting a whole screen to AppKit when one wrapped control or coordinator would do.
- Keep ownership explicit.
- SwiftUI owns value state, selection, and observable models.
- AppKit objects stay inside the representable, coordinator, or bridge object.
- Expose a narrow interface back to SwiftUI.
- Bindings for editable state
- Small callbacks for events
- Focused bridge services only when necessary
- Validate lifecycle assumptions.
- SwiftUI may recreate representables.
- Coordinators exist to hold delegate and target-action glue, not as a second app architecture.
References
references/representables.md: choosing between view and view-controller wrappers, plus coordinator patterns.references/window-panels.md: window access, utility windows, and open/save panels.references/responder-menus.md: first responder, command routing, and menu validation.references/drag-drop-pasteboard.md: pasteboard, file URLs, and desktop drag/drop edges.
Guardrails
- Do not duplicate the source of truth between SwiftUI and AppKit.
- Do not let
Coordinatorbecome an unstructured dumping ground. - Do not store long-lived
NSVieworNSWindowinstances globally without a strong ownership reason. - Prefer a tiny tested bridge over rewriting the feature in raw AppKit.
- If a pattern can remain entirely in
swiftui-patterns, keep it there.
Output Expectations
Provide:
- the exact SwiftUI limitation being crossed
- the smallest recommended bridge type
- the data-flow boundary between SwiftUI and AppKit
- the lifecycle or validation risks to watch
More skills from the plugins repository
View all 600 skillsaccessibility-and-inclusive-visualization
make data visualizations accessible
Jun 30AccessibilityChartsData VisualizationDesignagent-browser
automate browser interactions for agents
Apr 6AgentsBrowser AutomationTestingagent-browser-verify
verify dev server output with automated browser
Apr 6Browser AutomationLocal DevelopmentTestingagents-sdk
build AI agents on Cloudflare Workers
Apr 6AgentsCloudflare WorkersSDKServerless +1ai-elements
build chat UIs with AI Elements
Apr 6FrontendReactshadcn/uiUI Components +1ai-gateway
configure Vercel AI Gateway
Apr 6AI InfrastructureCost OptimizationLLMPerformance +1
More from OpenAI
View publisherprior-auth-packet-builder
build healthcare prior authorization packets
openai-agents-python
Apr 16DocumentsHealthcareInsuranceRegulatory Complianceaspnet-core
build ASP.NET Core web applications
skills
Apr 12.NETASP.NET CoreBlazorC# +1chatgpt-apps
build ChatGPT Apps SDK applications
skills
Apr 12Apps SDKChatGPTMCPOpenAIcli-creator
build CLIs from API docs
skills
Apr 12API DevelopmentCLICodexcloudflare-deploy
deploy projects to Cloudflare
skills
Apr 12CloudflareCloudflare PagesCloudflare WorkersDeploymentdefine-goal
define and set measurable project goals
skills
May 23ProductivityProject ManagementStrategyTask Management