Column View (Browser) 分栏视图(层级浏览器) macos

Files

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

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

  1. 1 Path column路径列 NSBrowser

    “Each folder opening in a new column” is a path column in an NSBrowser.

    「每个文件夹在新列里打开」,每一列都是 NSBrowser 里的一列路径列。

    Prompt fragmentPrompt 片段

    an NSBrowser path column that keeps one visible level of the selected hierarchy

    NSBrowser 的一列路径列,保持所选层级中的一级可见

  2. 2 Branch indicator分支指示箭头 NSBrowserCell.isLeaf

    “The little arrow at the end of a folder row” is the branch indicator for a non-leaf cell.

    「文件夹行尾的小箭头」就是非叶子单元格的分支指示箭头。

    Prompt fragmentPrompt 片段

    the branch indicator on a non-leaf NSBrowserCell, showing that selecting the row will reveal another column

    非叶子 NSBrowserCell 上的分支指示箭头,表示选中该行会展开下一列

  3. 3 Selected path选中路径 NSBrowser.path

    “The highlighted row in every column” is the selected path through the browser.

    「每一列里高亮的那一行」连起来就是浏览器里的选中路径。

    Prompt fragmentPrompt 片段

    the NSBrowser selected path, with one highlighted ancestor row preserved in each visible column

    NSBrowser 的选中路径,每个可见列里都保留一个高亮的祖先行

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

Build a Finder-style Column View with NSBrowser and NSBrowserCell: selecting a non-leaf row reveals its children in a new column immediately to the right, preserving the visible hierarchy path. Do not substitute a flat list or a single sidebar-detail split.

用 NSBrowser 和 NSBrowserCell 构建 Finder 风格的分栏视图:选中非叶子行时,它的子项立即在右侧新列中出现,保持层级路径可见。不要用扁平列表或单个「边栏+详情」拆分布局来替代。

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

Debug my macOS column view (NSBrowser, Miller columns). Rule out: stale columns because reloadColumn/reloadData never ran after the model changed; confusing path-based selection with item-based delegate methods; lazy child loading never triggered because isLeafItem answers wrong; the horizontal scroll position jumping when columns are added. The symptom:

调试我的 macOS 分栏视图(NSBrowser、Miller columns)。排除以下可能:模型变了之后没调 reloadColumn/reloadData,列内容是旧的;把基于 path 的选中和基于 item 的 delegate 方法搞混;isLeafItem 回答错了,子项的懒加载永远不触发;新增列时水平滚动位置乱跳。症状是:

In code代码里叫什么

Framework框架Symbol符号Note说明
AppKit NSBrowser
AppKit NSBrowserCell
SwiftUI NavigationSplitView approximate; no direct equivalent近似方案;没有直接等价物

See also相关词条