AppKit sample architecture
Source-backed, high-level architecture notes for Apple sample-code pages grouped in the AppKit folder.
- Catalog module label:
AppKit - Coverage: 11 / 11 sample pages documented
- Source policy: archive hashes and extracted-tree references are verified locally before analysis
Samples
| Sample | Platforms | High-level architecture | Documented patterns |
|---|---|---|---|
| Add Functionality to Finder with Action Extensions | macOS | A nearly empty host app plus three independent extension targets; small NSImage extensions hold reusable transformations. |
App extension, Framework callback, Shared utility extension |
| Creating and Customizing the Touch Bar | macOS | Two parallel implementations—Swift and Objective-C—of the same catalog-style AppKit app. | Catalog, Delegate, Storyboard routing, Singleton |
| Developing a Document-Based App | macOS | AppKit document architecture: NSDocument bridges a small content model to storyboard-created window and view controllers. |
Document architecture, Model-View-Controller, Delegate |
| Enhancing your custom text engine with Writing Tools | macOS | DocumentViewController composes a text-focused view model with a custom NSView; capability extensions implement editing, selection, pasteboard, and Writing Tools callbacks. |
View model, Delegate, Capability extensions, Adapter |
| Integrating a Toolbar and Touch Bar into Your App | macOS | A content view controller owns the text view; one window controller owns command logic and constructs both command surfaces. | Controller, Delegate factory, Target-action, Cocoa binding |
| Navigating Hierarchical Data Using Outline and Split Views | macOS | Node model + NSTreeController/outline controller + split/detail controllers, coordinated through notifications and child containment. |
Model-View-Controller, Observer, Child view controller, Capability extensions |
| Organize Your User Interface with a Stack View | macOS | Three small protocols compose a host, header, and body into StackItemContainer; concrete view controllers supply each role. |
Protocol composition, Container, Template method, State restoration |
| Restoring your app’s state with AppKit | macOS | App delegate owns window-controller lifetimes; a restoration factory recreates them; controllers encode identifiers and transient UI state; a singleton manager owns persistent products. | State restoration, Factory, Singleton model owner, Delegate |
| Supporting Collection View Drag and Drop Through File Promises | macOS | A controller owns collection state and operation queues; PhotoItem owns per-photo loading state; delegate extensions implement drag/drop and file-promise contracts. |
Model-View-Controller, Operation, Delegate, File promise |
| Supporting Drag and Drop Through File Promises | macOS | ImageCanvas owns editing/rendering; ImageCanvasController adapts drag/drop and promise APIs; an immutable snapshot carries deferred export data. |
Delegate, Snapshot, File promise, Target-action |
| Supporting Table View Drag and Drop Through File Promises | macOS | A view controller owns the bound content array and operation queues; model objects lazily load thumbnails; a capability extension implements table and promise protocols. | Model-View-Controller, Operation, Delegate, Cocoa binding, File promise |
Cross-sample signals
Recurring documented patterns
| Pattern label | Sample documents |
|---|---|
| Delegate | 7 |
| Model-View-Controller | 4 |
| File promise | 3 |
| Capability extensions | 2 |
| Target-action | 2 |
| Cocoa binding | 2 |
| State restoration | 2 |
| Operation | 2 |
Type-role naming evidence
Counts below are declaration-name suffixes, not inferred patterns.
| Role suffix | Distinct declarations across samples |
|---|---|
Controller |
61 |
View |
19 |
Delegate |
18 |
Operation |
4 |
Handler |
2 |
Manager |
2 |
Provider |
2 |
Document |
1 |
ViewModel |
1 |
Model |
1 |
Swift access-control evidence
These are declaration occurrences in scanned Swift source, including implicit internal declarations.
| Access level | Occurrences |
|---|---|
implicit internal |
1880 |
private |
153 |
public |
6 |
fileprivate |
1 |
private(set) |
1 |
References
Generated from the verified local catalog and completed Markdown documents.