AppKit
01 / 02

AppKit Fundamentals: NSView, NSWindow & the Responder Chain

AppKit: NSView, NSWindow & the Responder Chain

AppKit is Apple's original, mature framework for building native macOS desktop application UIs, predating both UIKit and SwiftUI. It shares Cocoa's design heritage with UIKit, so many concepts (view hierarchies, view controllers, a responder chain) carry over conceptually despite targeting a very different platform.

NSView & NSWindow

class CustomView: NSView {
  override func draw(_ dirtyRect: NSRect) {
    NSColor.systemBlue.setFill()
    dirtyRect.fill()
  }
}

// NSWindow hosts a content view hierarchy and manages
// window-level behavior -- resizing, title bar, minimizing --
// a macOS-specific concept with no direct iOS equivalent

The Responder Chain

When an event (a key press, a menu command) occurs, AppKit passes it along a chain of responder objects -- starting from the first responder (like a focused text field) -- until something in the chain handles it.

Menu Bar & Keyboard-Driven Interaction

Unlike iOS's touch-first design, macOS centers around mouse/trackpad plus keyboard input, with a persistent app-wide menu bar (NSMenu) as a fundamental, expected part of any well-behaved macOS app.

Handling Window Resizing

macOS windows are commonly and freely resized, tiled, or full-screened by the user -- so Auto Layout constraints matter significantly more for graceful adaptation than in many fixed-size iOS layouts.

Keep your own version of these notes — editable, searchable, and organised by your stack.

Start free