Sidebar (Source List) 边栏(源列表) macos

Favorites

Desktop

标本可交互 —— 点点看。Specimen is live — try it.

Anatomy — every part, named解剖 —— 每个部件的名字

  1. 1 Source-list style源列表样式 NSTableView.Style.sourceList

    The spacious, vibrancy-aware Finder-like treatment of the rows is AppKit's source-list style.

    行距宽松、带 vibrancy 效果的访达式行外观,就是 AppKit 的源列表样式。

    Prompt fragmentPrompt 片段

    the native source-list style (NSTableView.Style.sourceList): Finder-like sidebar rows over a translucent background with system spacing

    原生源列表样式(NSTableView.Style.sourceList):半透明背景上、采用系统间距的访达式边栏行

  2. 2 Section header分区标题 NSOutlineViewDelegate.outlineView(_:isGroupItem:)

    The small emphasized label dividing destinations into groups such as Favorites or iCloud is a section header.

    把目的地分成“个人收藏”“iCloud”等组的小号强调标签,就是分区标题。

    Prompt fragmentPrompt 片段

    a sidebar section header (NSOutlineViewDelegate.outlineView(_:isGroupItem:)): the non-destination group label above a cluster of source-list rows

    边栏分区标题(NSOutlineViewDelegate.outlineView(_:isGroupItem:)):一组源列表行上方、本身不是目的地的分组标签

  3. 3 Selection pill选中胶囊 NSTableRowView.isSelected

    “The rounded colored background behind the current row” is the sidebar's selection pill.

    “当前行后面那个圆角彩色背景”就是边栏的选中胶囊。

    Prompt fragmentPrompt 片段

    the sidebar selection pill (NSTableRowView.isSelected): the accent-tinted rounded background behind the active source-list row

    边栏选中胶囊(NSTableRowView.isSelected):当前源列表行后面的强调色圆角背景

  4. 4 Sidebar toggle toolbar button边栏开关工具栏按钮 NSSplitViewController.toggleSidebar(_:)

    The standard split-rectangle toolbar icon that reveals or hides the leading column is the sidebar toggle.

    工具栏上那个标准的分栏矩形图标,用来显示或隐藏前侧栏,就是边栏开关。

    Prompt fragmentPrompt 片段

    the sidebar toggle toolbar button (NSSplitViewController.toggleSidebar(_:)): the standard split-rectangle icon that collapses or reveals the leading sidebar

    边栏开关工具栏按钮(NSSplitViewController.toggleSidebar(_:)):标准的分栏矩形图标,用于折叠或展开前侧边栏

Prompt — paste into your agentPrompt —— 直接粘贴给你的代理

Build a macOS Sidebar (Source List) with NavigationSplitView (AppKit: NSSplitViewController), using the native translucent sidebar appearance and source-list row selection. It must occupy the left column, support collapsing, and keep navigation separate from the detail content.

用 NavigationSplitView(AppKit:NSSplitViewController)构建 macOS 边栏(源列表),使用原生半透明边栏外观和源列表式的行选中。它必须占据左侧列、支持折叠,并让导航与详情内容分离。

Debug prompt — when it misbehaves调试 Prompt —— 当它不听话时

Debug my macOS sidebar (NSSplitViewController sidebar item, SwiftUI NavigationSplitView). Rule out: the frosted vibrancy missing because the sidebar content is not inside the sidebar-material effect view; toggleSidebar wired to the wrong split view item; the width not persisting without an autosaveName; the selection highlight losing its rounded inset style when the list style changes. The symptom:

调试我的 macOS 边栏(NSSplitViewController sidebar item、SwiftUI NavigationSplitView)。逐一排除:磨砂的 vibrancy 效果缺失,因为边栏内容没有放进 sidebar 材质的效果视图里;toggleSidebar 接错了拆分视图项;没有 autosaveName 导致宽度无法记住;列表样式变化后选中高亮失去了圆角内嵌样式。症状是:

In code代码里叫什么

Framework框架Symbol符号Note说明
SwiftUI NavigationSplitView
AppKit NSSplitViewController
AppKit NSSplitViewItem(sidebarWithViewController:)
AppKit NSTableView.Style.sourceList the standard AppKit list appearanceAppKit 标准的列表外观
SwiftUI ListStyle.sidebar

See also相关词条