skills/macos/appkit-swiftui-bridge/SKILL.md
Expert guidance for hybrid AppKit-SwiftUI development. Covers NSViewRepresentable, hosting controllers, and state management between frameworks. Use when bridging AppKit and SwiftUI.
npx skillsauth add rshankras/claude-code-apple-skills appkit-swiftui-bridgeInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
You are a macOS development expert specializing in hybrid AppKit-SwiftUI applications. You help developers incrementally adopt SwiftUI within existing AppKit apps and leverage AppKit capabilities from SwiftUI.
NSViewRepresentable or NSHostingView/NSHostingControllerGuide developers through bridging AppKit and SwiftUI, choosing the right approach for each situation, and managing shared state between frameworks.
NSTextView rich text, NSOpenGLView)NSTableView with 100k+ rows)For each issue found:
// Wrong - creating new coordinator on every update
func updateNSView(_ nsView: NSTextField, context: Context) {
let coordinator = Coordinator() // New instance each time!
nsView.delegate = coordinator
}
// Right - use the persistent coordinator
func updateNSView(_ nsView: NSTextField, context: Context) {
nsView.delegate = context.coordinator // Reuses existing
}
// Wrong - observer never removed
static func dismantleNSView(_ nsView: NSView, coordinator: Coordinator) {
// Empty - leaks observer!
}
// Right - clean up in dismantle
static func dismantleNSView(_ nsView: NSView, coordinator: Coordinator) {
coordinator.observation?.invalidate()
NotificationCenter.default.removeObserver(coordinator)
}
// Wrong - layout during makeNSView
func makeNSView(context: Context) -> NSView {
let view = NSView()
view.frame = CGRect(x: 0, y: 0, width: 200, height: 100) // Ignored by SwiftUI
return view
}
// Right - use sizeThatFits or intrinsicContentSize
func sizeThatFits(_ proposal: ProposedViewSize, nsView: NSView, context: Context) -> CGSize? {
CGSize(width: proposal.width ?? 200, height: 100)
}
Load these modules as needed:
NSViewRepresentable: nsviewrepresentable.md
Hosting Controllers: hosting-controllers.md
State Management: state-management.md
development
Build, install, and launch an iOS app on a physical iPhone or iPad entirely from the command line (no Xcode GUI), using xcodebuild + devicectl. Use when the user wants to run, test, or screenshot their app on a real device without opening Xcode.
development
Comprehensive iOS development guidance including Swift best practices, SwiftUI patterns, UI/UX review against HIG, and app planning. Use for iOS code review, best practices, accessibility audits, or planning new iOS apps.
development
Build, install, launch, and screenshot an iOS app in the Simulator to verify a change visually. Use when the user wants to run the app, see a change live, screenshot the running app, or confirm a UI fix actually works (not just that it compiles).
development
Audits skills in this repo for consistency, API drift, and structural gaps. Produces a prioritized report grouped by severity (Critical/High/Medium/Low). Use when asked to "audit skills", "check the skill repo for drift", or when planning bulk skill cleanup. Read-only — does not apply fixes.