Examples
Every example under Examples/ is a single-file host that builds on OpenNook’s
public API only - no forking, no patched framework. Each one is its own SPM
target, so you run it straight from the repo with swift run <Name> and press
the show/hide hotkey (the default is the option-command-semicolon combination)
to expand the nook.
They are grouped here so you can jump to the one closest to what you are building. Each entry links to the guide that explains the concept in full.
Getting started
Section titled “Getting started”The smallest hosts - one view, or one view plus a compact-slot glyph. Start here if you have never run an OpenNook app.
- HelloNook -
swift run HelloNook. The smallest possible app: handNookApp.mainone SwiftUI view and the top bar, Settings, hotkey, and compact pill all come for free. See Your first nook. - ClockNook -
swift run ClockNook. A live-clock home surface plus a custom compact glyph, showing thesetHomeandsetCompactTrailingregistration knobs side by side. See Your first nook.
Customization
Section titled “Customization”Reshaping the chrome - palette, lifecycle hooks, brand mark, layout - through
NookConfiguration.
- ThemedNook -
swift run ThemedNook. A host-suppliedNookResolvedThemethat paints the chrome labels, plus theonExpand/onCompactlifecycle callbacks. See Theming. - ChromeNook -
swift run ChromeNook. A tour of the deeper chrome seams: launch-preference defaults, hover and backdrop behavior, label and metric overrides, a custom brand mark, top-bar trailing actions, and the status banner. See Chrome customization. - LayoutNook -
swift run LayoutNook. The recommended expanded-width and content-inset patterns - how a home view reads\.nookContentInsetsinstead of adding its own horizontal padding. See Layout and content insets.
Components
Section titled “Components”Drop-in surfaces from the NookComponents add-on. Each imports
NookComponents alongside NookApp.
- ShelfNook -
swift run ShelfNook. A file shelf in the notch: drag files on to collect them, drag them back out to Finder, persisted across launches. See File shelf. - ActivityNook -
swift run ActivityNook. ANookActivityQueuethat collects transient activities and briefly takes over the expanded surface for each, one at a time. See Activity queue. - VolumeNook -
swift run VolumeNook. An ambient volume glyph in the compact pill - aSystemVolumeObservertracks the output level andNookVolumeIndicatorrenders it beside the notch. See Volume glyph.
Hosting
Section titled “Hosting”Running more than one notch app in a single process.
- MultiNook -
swift run MultiNook. One host process with several interchangeable modules sharing one surface, switched through the menu bar, the cycle hotkey, or an in-surface switcher. See Multiple modules.
See also
Section titled “See also”- The
Examples/directory in the repository - the source for every app above. - Your first nook - the walkthrough HelloNook and ClockNook accompany.