macos-native-development

Provides macOS native app development guidance for Swift, Objective-C++ and AppKit projects.

2|Updated May 15, 2015
One-click install
npx skills add https://github.com/stephendolan/dotfiles --skill macos-native-development
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: macos-native-development
Source: https://github.com/stephendolan/dotfiles/tree/main/claude/skills/macos-native-development
Command: npx skills add https://github.com/stephendolan/dotfiles --skill macos-native-development

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill provides guidance for building macOS native apps with Swift/ObjC++, focusing on event handling, lifecycle management, and platform quirks.

Core Features & Use Cases

  • CGEvent vs NSEvent: When to prefer low-level CGEvent for reliability.
  • Event Tap & Lifecycle: Safe event taps and cleanup practices.
  • System Integrations: Best practices for Status Bar, ScreenCaptureKit, and SwiftUI in AppKit.

Quick Start

Show a CGEvent-based key event handler that logs key codes.

Frequently Asked Questions about macos-native-development

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

FAQPage Schema
How do I handle keyboard events reliably in macOS native apps?

Use CGEvent for low-level keyboard handling instead of NSEvent when you need reliable event capture, especially for dead keys and focus-loss scenarios. CGEvent provides direct access to the event tap mechanism, giving you finer control over event processing in Swift and Objective-C++ applications.

What's the best way to integrate SwiftUI with AppKit in macOS applications?

Combine SwiftUI views with AppKit by managing explicit state and handling lifecycle cleanup carefully. This Skill covers safe integration patterns, status bar implementations, and techniques for maintaining consistent behavior across SwiftUI and AppKit components.

How do I capture screen content reliably using ScreenCaptureKit?

ScreenCaptureKit requires queue-based timeouts and versioning for async responses to handle capture reliably. This Skill provides guidance on structuring screen capture operations with proper error handling and cross-version compatibility for macOS.

Why should I use CGEvent over NSEvent for event handling?

CGEvent offers lower-level access and more reliable event interception than NSEvent, particularly for capturing system-wide keyboard input, handling dead keys, and managing focus loss. It's the preferred choice when NSEvent doesn't capture all event types your app needs.

How do I ensure my macOS app works across different macOS versions?

Handle platform quirks through version-aware code, explicit state management, and proper lifecycle cleanup. This Skill covers cross-version compatibility patterns for Swift and Objective-C++ apps using AppKit, SwiftUI, and low-level event handling.

What lifecycle management practices prevent crashes in macOS native apps?

Implement explicit state management and ensure cleanup of event taps and system integrations. This Skill provides patterns for safe event tap lifecycle, status bar item management, and resource cleanup to prevent memory leaks and hanging processes.