API reference
OpenNook publishes its symbol-level DocC reference through Swift Package Index, regenerated on each tagged release, at:
https://swiftpackageindex.com/twinkling-reality/opennook/documentation
The map below is the maintained index of the public surface, grouped by module, with the guide that teaches each piece and the source file that defines it. The source is always the source of truth.
Build that DocC reference yourself with ./Scripts/generate-docs.sh - it
produces the same combined site Swift Package Index hosts.
NookApp
Section titled “NookApp”The one-line entry point. import NookApp re-exports NookKit and
NookSurface, so a host needs only this single import.
NookApp.main- the boot overloads: a view builder, aNookConfiguration, aNookHostConfiguration, and a main-actor builder closure for setup that constructs main-actor-isolated types. See Your first nook. Source:Sources/NookApp/NookApp.swift.
NookKit
Section titled “NookKit”The app chrome layered over NookSurface.
- Registration -
NookConfiguration,NookTopBarConfiguration. The host-app seam: home/compact content, theme, lifecycle hooks, chrome flags, the shape/animation/width knobs (withNookConfiguration.defaultStyle, the framework’s own shape), andsetSettings(_:). See Your first nook and Settings chrome. Source:Sources/NookKit/App/NookConfiguration.swift. - Top bar -
NookTopBarConfiguration.symbols(NookChromeSymbols,\.nookChromeSymbols): the lock, gear, breadcrumb, back, and module-switcher glyphs;leadingIconView(setLeadingIcon(_:)): a view for the leading icon; andcontent(setContent(_:),NookConfiguration.setTopBar(_:)): a host bar built fromNookTopBarContext(withNookTopBarContext.ModuleSwitcher), which carries the bar’s state and the keep-open, Settings, back, and module-switching actions. See Chrome customization. Source:Sources/NookKit/App/NookChromeSymbols.swift,Sources/NookKit/App/NookTopBarContext.swift. - Opening -
NookAppearancePreferences.openOnHover(NookOpenOnHover),hoverDelay,externalDisplayHoverDelay, andpeekDwell, offered in Settings and mapped tohoverIntent;NookChromeBehavior.hoverIntentfixes them in code;NookConfiguration.setPeek(_:)gives a module a peek; andNookSurfaceClaim.presentation(NookSurfacePresentation) withNookSurfacePresenting.endTransientPresentation(_:after:)for claims that peek or end on a schedule. See Hover and peek. Source:Sources/NookKit/App/NookAppearancePreferences.swift,Sources/NookKit/App/NookSurfacePresenting.swift. - Live activities -
NookLiveActivity(withPriority,Lifetime, andAlert), started through a module’sNookLiveActivities(NookLiveActivitiesKey,\.nookLiveActivities);NookActivityCenter(NookModuleRegistry.liveActivities) orders them for the pill;NookActivityPolicy(NookHostConfiguration.activityPolicy) sets the capsules; andNookModuleDescriptor.loadsAtLaunchstarts a resident module at launch. See Live activities. Source:Sources/NookKit/App/Activities/. - Shared elements -
View.nookSharedElement(_:style:)(NookSharedElementStyle) moves an element between the compact pill, the peek, and the expanded content;\.nookSharedElementScopescopes its id (NookKit sets the supplying module);NookTransitionConfiguration.sharedElementAnimationandsharedElementPeekAnimationset its curves. See Shared elements. Source:Sources/NookSurface/NookSharedElement.swift. - Widgets and boards -
NookWidget(withNookWidget.Action),NookWidgetSize,NookWidgetSource,NookConfiguration.addWidget(_:),widgets, andwidgetSource;NookWidgetGridlays widgets out in any view;NookBoardConfiguration(withAdmission),NookWidgetPlacement, andNookHostConfiguration.registerBoard(_:)make a board module whose home is every loaded module’s widgets, arranged in its Settings. See Widgets and boards. Source:Sources/NookKit/App/Widgets/. - Chrome strings and motion -
NookChromeLabels(NookConfiguration.labels,\.nookChromeLabels) holds every string the framework draws, grouped asNookChromeLabels.TopBar,.Settings,.Appearance,.Display,.Shortcut,.MenuBar,.Components, and.Widgets, with{name}templates filled byNookChromeLabels.fill(_:_:);NookChromeMotion(NookConfiguration.motion,\.nookChromeMotion) holds the in-panel curves, includingsettingsDisclosure,moduleSwitch, andactivityCard. See Labels and Motion. Source:Sources/NookKit/App/NookChromeLabels.swift,Sources/NookKit/App/NookChromeLabelGroups.swift,Sources/NookKit/App/NookChromeMotion.swift. - Settings pieces -
NookSettingsGroups(NookConfiguration.settingsGroups),NookSettingsGroup,NookAppearanceSettingsSection,NookDisplaySettingsSection,NookShortcutSettingsSection,NookResetSettingsSection, andNookAboutSettingsSection: hide groups of the built-in Settings screen, or build your own from them. See Settings chrome. Source:Sources/NookKit/App/Views/Settings/. - Chrome behavior -
NookChromeBehaviorwithNookGlassShading(glassShading), the backdrop resolvers (backdrop,companionBackdrop) and theNookBackdropContextthey receive, andNookKeyboardBehavior(keyboard);NookBackdropMapping. See Chrome customization and Surface materials. Source:Sources/NookKit/App/NookChromeBehavior.swift,Sources/NookKit/App/NookBackdropContext.swift,Sources/NookKit/App/NookBackdropMapping.swift. - Keyboard -
AppCoordinator.takeNookKeyboardFocus(),releaseNookKeyboardFocus(),nookHasKeyboardFocus, andnookWindow;NookChromeActions.takeKeyboardFocus/releaseKeyboardFocus;nookFocusOnAppear(_:)andnookKeepsExpanded(whileFocused:);NookEditMenu. See Typing in the nook. Source:Sources/NookKit/App/AppCoordinator.swift,Sources/NookKit/System/NookEditMenu.swift. - Theme -
NookTheme(NookConfiguration.chromeTheme,NookHostConfiguration.chromeTheme,NookApp.main(theme:home:)): knobs,NookRadiusScale,NookMotionScheme,NookThemeTokenskeyed byNookColorID,NookDimensionID,NookFontID,NookAnimationID,NookTransitionID,NookSoundID, andNookShadowID, andNookThemeBackdrops. The values a theme holds:NookColorValue,NookRGBA,NookAdaptiveColor,NookSystemColor,NookDimension,NookAdaptiveNumber,NookFontSpec,NookAnimationSpec,NookContentTransitionSpec,NookGradientSpec,NookShadowSpec,NookSoundSpec,NookUnitPointSpec, andNookBackdropDescription. Resolution:NookThemeContext,NookResolvedTokens(\.nookThemeTokens),\.nookTheme,NookChromeColors(\.nookChromeColors). Files:NookThemeCoder,NookThemeLoadResult,NookThemeIssue,NookThemeError. Live themes:NookThemeSource(chromeThemeSource). Custom backdrop views:NookConfiguration.themeBackdrops. Feedback in the theme’s tint:AppCoordinator.playFeedback(_:duration:repeats:). Choreography:nookStaggered(index:)for rows that cascade in onmotion.stagger. Sounds:AppCoordinator.playSound(_:),NookChromeActions.playSound, andNookAppearancePreferences.soundsEnabled(the Settings “Sounds” row). See Theming, Choreography, and Sounds. Source:Sources/NookKit/Theme/. - Palette -
NookResolvedTheme. The flat palette every chrome view reads, includingaccent,fontDesign, and thehoverWash,destructive,warning, andsuccessroles. See Theming. Source:Sources/NookKit/App/NookResolvedTheme.swift. - Appearance preferences -
NookAppearancePreferences,NookChromePalette,NookSurfaceStyle. The persisted, user-facing surface and chrome state. See Theming. Source:Sources/NookKit/App/NookAppearancePreferences.swift. - Lifecycle -
AppCoordinator. The vocabulary the hotkey and menu-bar fallback call into (showNook,hideNook,toggleNook,toggleKeepNookOpen), plusswitchModule/cycleModuleand theNookSurfacePresentingconformance. See Your first nook. Source:Sources/NookKit/App/AppCoordinator.swift. - Live configuration -
AppCoordinator.reloadActiveConfiguration()rebuilds the active module’s configuration and applies it to the running chrome, andAppCoordinator.replaceChromeBehavior(_:)changes the host’s chrome behavior at runtime (ModuleHost.chromeBehaviorreads it back). See Playground. Source:Sources/NookKit/App/AppCoordinator.swift. - State -
AppState,NookViewMode,HotkeyRegistrationFailure. The observable chrome state;replaceAppearancePreferences(_:)is the persisted write path,preferenceDefaultsreads the host’s launch defaults back, andresetAppearancePreferences(),resetHotkey(), andresetDisplayPreference()return to them. Source:Sources/NookKit/App/AppState.swift. - Services -
AppServices,ServiceKey. The per-module dependency container resolved from\.appServices. See Multiple modules. Source:Sources/NookKit/App/AppServices.swift. - Multi-module hosting -
NookHostConfiguration,NookModule,ClosureModule,NookModuleDescriptor,NookModuleContext,NookModuleRegistry,NookHostBranding. See Multiple modules. Source:Sources/NookKit/App/Modules/. - Input and display -
NookHotkey(Sources/NookKit/System/NookHotkey.swift),NookDisplayPreference(Sources/NookKit/App/NookDisplayPreference.swift). - Companion surfaces -
NookCompanionandNookConfiguration.addCompanion(...), with the sharedcompanionStyle,companionSize, andcompanionPresence;NookCompanionSource(NookConfiguration.companionSource) for companions that come and go while the app runs; the glyph button styleNookGlyphButtonStyle(.nookGlyph); and the chrome controlsNookChromeActions(\.nookChromeActions),NookKeepOpenButton, andNookSettingsButton, with thetopBar.showsKeepOpenButton/showsSettingsButtonflags. See Companion surfaces. Source:Sources/NookKit/App/NookCompanion.swift,Sources/NookKit/App/NookCompanionSource.swift,Sources/NookKit/App/NookGlyphButtonStyle.swift,Sources/NookKit/App/NookChromeActions.swift. - Layout metrics -
NookLayout, the public chrome dimension constants (expanded width, edge padding, compact-slot size, breadcrumb width), andNookChromeMetrics, the host-tunable metrics bag (edgePadding, compact slot size, breadcrumb width, top-bar height). See Layout and content insets. Source:Sources/NookKit/App/Views/Layout/NookLayout.swift,Sources/NookKit/App/NookChromeMetrics.swift. - Notch clearance -
NookNotchClearance(topBar.notchClearance),NookNotchRow, and thenookNotchAccessories(leading:trailing:)modifier: keeping content clear of the hardware notch, and putting views beside it. See Layout and content insets. Source:Sources/NookKit/App/Views/Layout/NookNotchClearance.swift,Sources/NookKit/App/Views/Layout/NookNotchRow.swift.
NookSurface
Section titled “NookSurface”The low-level notch window, re-exported through NookApp. Most hosts drive
these through NookKit rather than directly; the host-facing knobs are:
NookStyle- corner radii,expandedContentInsets, and the built-in animation curves.Nook.styleandNook.hoverBehaviorare settable, so a running chrome can be restyled in place.NookTransitionConfiguration- per-instance animation overrides, and how content arrives and leaves (expandedContentTransition,expandedContentRemoval,compactContentTransition,compactContentRemoval).NookPresentation- notch-fused vs free-floating chrome.NookContentInsets- curve-derived safe-area insets for edge-pinned host content. See Layout and content insets.NookNotchCutout,\.nookNotchCutout- where the hardware notch falls in the host content frame. See Layout and content insets.NookCompanionSurface,NookCompanionAnchor,NookCompanionVisibility,NookCompanionShape,NookCompanionBackdrop- companion surfaces at the engine level (Nook.companions), with thenookCompanionVisibility(_:)/nookCompanionHidden(_:)modifiers,\.nookCompanionIsPresented, and\.nookCompanionIsHovered. See Companion surfaces.NookCompanionStyle,AnyNookCompanionStyle,NookStandardCompanionStyle,NookCompanionStyleConfiguration,NookCompanionFadeMask,NookOutlineShadow- how a companion surface is drawn;NookCompanionSize(\.nookCompanionSize) - the size a companion shares with its controls;NookCompanionPresence- how it comes and goes. See Companion surfaces.NookBackdropView,\.nookChromeBackdrop- the chrome’s backdrop, painted in any shape by content and styles;Nook.companionBackdrop- what companions inherit instead;NookBackdrop.LiquidGlass.Shading.notchFade(_:strength:)- the notch fade gradient.Nook.layoutForm(NookChromeForm) - the layoutNook.presentationresolved to on the chrome’s current screen, notch-fused or floating.Nook.takeKeyboardFocus(),releaseKeyboardFocus(),hasKeyboardFocus(\.nookHasKeyboardFocusin content), andNook.window- the panel’s keyboard focus and the panel itself. See Typing in the nook.NookRimGlowStyle,NookRimGlowPreferenceKey,nookRimGlow(_:)- the glowing rim;NookScrollEdgeFade,nookScrollEdgeFade(...),\.nookScrollEdgeFade- the scroll edge fade. See Rim glow and edge fade.NookBackdrop.GradientFill,NookBackdrop.Custom, and the.gradient,.meshGradient, and.custombackdrops. See Surface materials.NookShape,NookOutline,\.nookChromeShape, andNookContentTransition- the chrome’s outline and how content arrives and leaves, with its ownanimationand an arrivaldelay.NookHoverHaptic(Nook.hoverHaptic). See Chrome customization.NookChromeShadow(Nook.chromeShadow),NookFeedbackStyle, andNookAmbientWash(Nook.ambientWash). See Rim glow and edge fade.Nook.peekContent,peek(on:),endPeek(),isPeeking, andNookHoverIntent(Nook.hoverIntent) - the compact pill’s peek and what hovering it does, with the peek’sNookStyleandNookTransitionConfigurationfields. See Hover and peek.
Both NookStyle and NookTransitionConfiguration are surfaced on
NookConfiguration; see
Theming and
Layout and content insets. The remaining
surface types (Nook, NookState, NookBackdrop, NookHoverBehavior,
NookFeedback) live under Sources/NookSurface/.
NookComponents
Section titled “NookComponents”Opt-in add-ons. Add the NookComponents product to your target only when you
want one; it is not pulled in by NookApp.
- Shelf -
ShelfStore,ShelfItem,NookShelfView,ShelfRuntime. See File shelf. Source:Sources/NookComponents/Shelf/. - Activities -
NookActivity,NookActivityPriority,NookActivityQueue,NookActivityHost,NookActivityCard. See Activity queue. Source:Sources/NookComponents/Activities/. - Volume -
SystemVolumeObserver,VolumeReading,CoreAudioVolumeReader,NookVolumeIndicator. See Volume glyph. Source:Sources/NookComponents/Volume/.