# 第 53 章示例 · AppKit 桥接 `NSViewRepresentable` 最小实现、`NSMenu` 构建、`NSHostingView` 尺寸、`NSWindow` 配置应用、桥接计数。 ## 运行 swift run Ch53Demo # 菜单/窗口/宿主视图的真实 AppKit 输出 swift run Ch53App # 打开桥接说明窗口 ## 验证 swift test # 8 个测试(AppKit 套件 MainActor) ./run.sh # build + test + 快照比对 ## 截图 SHOTS_DIR=shots swift run Ch53Demo # 写出 shots/bridging-board.png ## 结构 | 文件 | 对应小节 | 说明 | | --- | --- | --- | | `Sources/Ch53Kit/Bridging.swift` | 53.1–53.4 | `MenuBuilder` / `WindowConfig` / `LabelField` | | `Sources/Ch53Demo/App.swift` | 53.2 / 53.5 | NSHostingView / NSWindow 实测 | ## 已知限制 `NSViewRepresentable` 的 `makeNSView` 需要 `Context`,示例不直接调用;桥接行为在 App 与测试中用 AppKit 对象验证。真窗口的菜单栏与工具栏需在 App 内手测。