
Appkit Interop
- 22 installs
- 4.9k repo stars
- Updated July 14, 2026
- openai/plugins
appkit-interop bridges SwiftUI to AppKit for windows, menus, and panels.
About
The appkit-interop skill bridges macOS SwiftUI into AppKit narrowly when implementing representables, reaching NSWindow or panels, handling menus, or using the responder chain. It avoids duplicating source of truth between SwiftUI and AppKit state, keeps Coordinator objects focused, and limits bridge surface to APIs SwiftUI cannot express. Workflow identifies the minimal NSView or NSViewController representable, documents lifecycle callbacks, and validates focus, key window, and menu validation behavior. Pair with swiftui-patterns and window-management before reaching for AppKit. Output describes bridge scope, state ownership, and manual QA steps for keyboard shortcuts and menu items. Guardrails forbid letting Coordinator become an unstructured dumping ground or using AppKit when SwiftUI modifiers suffice. Use this skill when SwiftUI is close but not quite enough for native macOS behavior. the source of truth, while AppKit handles the imperative edge.
- Implements narrow AppKit bridges from SwiftUI representables.
- Keeps single source of truth across SwiftUI and AppKit.
- Covers NSWindow, panels, menus, and responder chain hooks.
- Validates focus, key window, and menu validation behavior.
- Uses AppKit only when SwiftUI lacks equivalent APIs.
Appkit Interop by the numbers
- 22 all-time installs (skills.sh)
- +1 installs in the week ending Jul 26, 2026 (Skillselion tracking)
- Ranked #710 of 1,039 Mobile Development skills by installs in the Skillselion catalog
- Data as of Aug 4, 2026 (Skillselion catalog sync)
appkit-interop capabilities & compatibility
- Capabilities
- narrow bridge workflow · coordinator discipline guardrails
- Use cases
- frontend
- Platforms
- macOS
What appkit-interop says it does
Do not duplicate the source of truth between SwiftUI and AppKit
npx skills add https://github.com/openai/plugins --skill appkit-interopAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 22 |
|---|---|
| repo stars | ★ 4.9k |
| Last updated | July 14, 2026 |
| Repository | openai/plugins ↗ |
How do I access NSWindow from SwiftUI safely?
Bridge macOS SwiftUI into AppKit narrowly for windows, menus, and responder chain.
Who is it for?
macOS SwiftUI developers needing NSWindow or menu hooks.
Skip if: Skip when SwiftUI scene modifiers fully cover the need.
When should I use this skill?
User implements representables, menus, or responder chain in AppKit.
What you get
Minimal representable bridge with documented state ownership.
Files
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
1. Name the capability gap precisely.
- Window behavior
- Text system behavior
- Menu validation
- Drag and drop
- File open/save panels
- First responder control
2. Pick the smallest boundary that solves it.
- Avoid porting a whole screen to AppKit when one wrapped control or coordinator would do.
3. Keep ownership explicit.
- SwiftUI owns value state, selection, and observable models.
- AppKit objects stay inside the representable, coordinator, or bridge object.
4. Expose a narrow interface back to SwiftUI.
- Bindings for editable state
- Small callbacks for events
- Focused bridge services only when necessary
5. 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
interface:
display_name: "AppKit Interop"
short_description: "Bridge SwiftUI into AppKit for native macOS behavior"
default_prompt: "Use $appkit-interop to choose the smallest AppKit bridge, keep SwiftUI as the source of truth, and implement macOS-specific behavior that SwiftUI does not model cleanly."
Drag, Drop, and Pasteboard
Intent
Use this when desktop drag/drop or pasteboard behavior exceeds what plain SwiftUI modifiers cover comfortably.
Good fits
- File URL dragging
- Pasteboard interoperability with other macOS apps
- Rich drag previews or AppKit-specific drop validation
- Legacy AppKit views with custom drag types
Core patterns
- Start with SwiftUI drag/drop APIs when they already cover the use case.
- Drop to AppKit when you need
NSPasteboard, custom pasteboard types, or older AppKit delegate flows. - Keep data conversion at the boundary instead of leaking AppKit types through the whole feature.
Pitfalls
- Do not move your whole list or canvas into AppKit just for one drop target.
- Keep file and pasteboard types explicit and validated.
Representables
Intent
Use this when wrapping an AppKit control or controller for a SwiftUI macOS app.
Choose the wrapper type
- Use
NSViewRepresentablefor a view-level bridge such asNSTextView,NSScrollView, or a custom AppKit control. - Use
NSViewControllerRepresentablewhen you need controller lifecycle, delegate coordination, or AppKit presentation logic.
Skeleton
struct LegacyTextView: NSViewRepresentable {
@Binding var text: String
func makeCoordinator() -> Coordinator {
Coordinator(text: $text)
}
func makeNSView(context: Context) -> NSScrollView {
let scrollView = NSScrollView()
let textView = NSTextView()
textView.delegate = context.coordinator
scrollView.documentView = textView
return scrollView
}
func updateNSView(_ nsView: NSScrollView, context: Context) {
guard let textView = nsView.documentView as? NSTextView else { return }
if textView.string != text {
textView.string = text
}
}
final class Coordinator: NSObject, NSTextViewDelegate {
@Binding var text: String
init(text: Binding<String>) {
_text = text
}
func textDidChange(_ notification: Notification) {
guard let textView = notification.object as? NSTextView else { return }
text = textView.string
}
}
}Pitfalls
- Avoid infinite update loops by only pushing state into AppKit when values actually changed.
- Keep delegates and target-action wiring in the coordinator.
- If the wrapper grows into a full screen, re-evaluate the boundary.
Responder Chain and Menus
Intent
Use this when command handling depends on the active window, first responder, or AppKit menu validation.
Core patterns
- Start with SwiftUI
commands,FocusedValue, and focused scene state. - Use AppKit responder-chain hooks only when command routing or validation truly depends on the underlying responder system.
- Keep menu enablement rules close to the state they depend on.
Good fits for AppKit
- Validating whether a menu item should be enabled
- Routing actions through the current first responder
- Integrating with existing AppKit document or text behaviors
Pitfalls
- Do not recreate AppKit-style global command handling when SwiftUI focused values would work.
- Avoid scattering command logic between SwiftUI closures and AppKit selectors without a clear boundary.
Windows and Panels
Intent
Use this when SwiftUI scenes are not enough for the required macOS window or panel behavior.
Common cases
- Accessing the backing
NSWindow - Configuring titlebar or toolbar behavior
- Presenting
NSOpenPanelorNSSavePanel - Managing utility panels or floating windows
Core patterns
- Prefer SwiftUI
Window,WindowGroup, andopenWindowfirst. - Use AppKit only for window features SwiftUI does not expose cleanly.
- Keep file open/save panels behind a small service or helper instead of scattering panel setup throughout the view tree.
Example: open panel
@MainActor
func chooseFile() -> URL? {
let panel = NSOpenPanel()
panel.canChooseFiles = true
panel.canChooseDirectories = false
panel.allowsMultipleSelection = false
return panel.runModal() == .OK ? panel.url : nil
}Pitfalls
- Do not let random views own long-lived
NSWindowreferences. - Keep floating panels and utility windows consistent with the scene model.
- If the behavior is really just settings or a secondary scene, go back to
swiftui-patterns.
Related skills
FAQ
What does appkit-interop do?
appkit-interop bridges SwiftUI to AppKit for windows, menus, and panels.
When should I use appkit-interop?
User implements representables, menus, or responder chain in AppKit.
Is this skill safe to install?
Review the Security Audits panel on this page before installing in production.