docs: 补充注释、修正过时文档、清理重复内容

源码注释:
- 为 ~60 个 Swift 文件补充缺失的 doc comment(file header、类型、属性、方法)
- 修正 4 处错误注释:翻页模式数量、搜索行为描述、手势识别器描述、悬空文档块

文档维护:
- 删除重复文档:WXRead/读书EPUB阅读器实现架构.md(与微信读书版完全一致)
- 合并重叠文档:阅读器规划.md → 阅读器功能开发计划.md(单一真值)
- 修正过时内容:所有文档中"四种翻页模式"→"三种",移除 horizontalCoverScroll
- 更新架构图:补齐 EPUBUI/ReaderController、Paging/、Typesetter/ 等子目录
- 更新 index.md 索引:新增开发计划和架构对比文档引用
This commit is contained in:
shen
2026-06-01 09:33:23 +08:00
parent 1efb9d172f
commit 948004eed1
56 changed files with 1691 additions and 792 deletions
+101 -29
View File
@@ -21,70 +21,143 @@ RDReaderView 是一个 iOS 阅读器组件库(CocoaPods),提供开箱即
│
┌───────────────────────────▼─────────────────────────────┐
│ EPUBUI 层(library 级读者 UI) │
│ RDEPUBReaderController(开箱即用入口,~1995 行) │
│ RDEPUBReaderConfiguration / Theme / Settings / Persistence│
│ TopToolView / BottomToolView / ToolView 基类 │
│ ChapterList / Highlights / Bookmarks / Settings 面板 │
│ RDEPUBTextContentView / RDEPUBWebContentView │
│ RDEPUBPageInteractionController / SelectionOverlayView │
│ RDEPUBPageLayoutSnapshot / RDURLReaderController │
│ │
│ 主控制器 │
│ RDEPUBReaderController(开箱即用入口) │
│ +ContentDelegates / +DataSource / +PublicAPI │
│ +RenderSupport / +RuntimeBridge / +TableOfContents │
│ RDURLReaderController(URL 阅读入口) │
│ │
│ ReaderController/(协调器) │
│ RDEPUBReaderRuntime(中央运行时协调器) │
│ RDEPUBReaderContext(上下文状态容器) │
│ RDEPUBReaderDependencies(依赖注入) │
│ RDEPUBReaderLoadCoordinator(EPUB 加载) │
│ RDEPUBReaderPaginationCoordinator(分页协调) │
│ RDEPUBReaderLocationCoordinator(位置持久化) │
│ RDEPUBReaderAnnotationCoordinator(标注管理) │
│ RDEPUBReaderSearchCoordinator(搜索) │
│ RDEPUBReaderChromeCoordinator(工具栏) │
│ RDEPUBReaderAssemblyCoordinator(UI 组装) │
│ RDEPUBReaderViewportMonitor(视口变化监听) │
│ │
│ Settings/(配置与主题) │
│ RDEPUBReaderConfiguration / RDEPUBReaderSettings │
│ RDEPUBReaderSettingsViewController / RDEPUBReaderTheme │
│ │
│ TextPage/(文本页面交互) │
│ RDEPUBTextContentView / RDEPUBTextPageRenderView │
│ RDEPUBSelectableTextView / RDEPUBTextSelectionController│
│ RDEPUBSelectionOverlayView / RDEPUBTextAnnotationOverlay│
│ RDEPUBPageInteractionController / RDEPUBPageLayoutSnapshot│
│ RDEPUBTextPageDecorationView │
│ │
│ 工具栏与面板 │
│ RDEPUBReaderTopToolView / RDEPUBReaderBottomToolView │
│ RDEPUBReaderToolView(基类) │
│ RDEPUBReaderChapterListController(目录面板) │
│ RDEPUBReaderHighlightsViewController(高亮管理) │
│ RDEPUBReaderPersistence(位置持久化) │
│ RDEPUBReaderDelegate / RDEPUBReaderTableOfContentsItem│
│ RDEPUBWebContentView / RDEPUBWebDecorationOverlayView │
│ RDEPUBViewportTypes / UIColor+RDEPUBHex │
└───────────────────────────┬─────────────────────────────┘
│
┌───────────────────────────▼─────────────────────────────┐
│ 翻页容器层(RDReaderView) │
│ │
│ RDReaderView(UIView,统一翻页外壳) │
│ 4 种翻页模式:pageCurl / horizontalScroll / │
│ verticalScroll / horizontalCoverScroll │
│ 3 种翻页模式:pageCurl / horizontalScroll / │
│ verticalScroll │
│ RDReaderViewProtocols(DataSource / Delegate / DisplayType)│
│ +CollectionView / +ContentAccess / +PageCurl / +ToolView │
│ RDReaderFlowLayout / RDReaderContentCell │
│ RDReaderPageChildViewController(pageCurl 页包装) │
│ RDReaderGestureController │
│ │
│ Paging/(翻页控制) │
│ RDReaderPagingController(转场与排队) │
│ RDReaderPreloadController(预加载与缓存) │
│ RDReaderSpreadResolver(双页配对) │
│ RDReaderTapRegionHandler(手势分区) │
└───────────────────────────┬─────────────────────────────┘
│
┌───────────────────────────▼─────────────────────────────┐
│ EPUBCore 层(EPUB 引擎) │
│ │
│ Publication 层 │
│ 解析与模型 │
│ RDEPUBParser(+Archive / +Package / +TOC / │
│ +ReadingProfile / +Resources) │
│ RDEPUBPublication(出版物聚合对象) │
│ RDEPUBModels(metadata / manifest / spine 模型) │
│ RDEPUBReadingModels(location / viewport / highlight) │
│ Models/ │
│ RDEPUBReadingLocationModels(location 模型) │
│ RDEPUBPaginationModels(分页模型) │
│ RDEPUBAnnotationModels(标注模型) │
│ RDEPUBTextAnchor / RDEPUBTextRangeAnchor(文本锚点) │
│ RDEPUBRenderRequest(渲染请求模型) │
│ │
│ Services 层 │
│ 服务层 │
│ RDEPUBResourceResolver(资源 URL 统一入口) │
│ RDEPUBResourceURLSchemeHandler(ss-reader:// 协议) │
│ RDEPUBPreferences(展示参数聚合) │
│ RDEPUBPaginator(离屏分页服务) │
│ RDEPUBStyleSheetBuilder / RDEPUBJavaScriptBridge │
│ RDEPUBFixedLayoutTemplate / RDEPUBAssetRepository │
│ │
│ Navigator 层 │
│ 会话与导航 │
│ RDEPUBReadingSession(状态机 + 会话协调) │
│ RDEPUBNavigatorState(状态枚举) │
│ RDEPUBNavigatorLayoutContext │
│ │
│ Resource View 层 │
│ WebView 渲染 │
│ RDEPUBWebView(+Configuration / +Reflowable / │
│ +FixedLayout / +JavaScriptBridge / │
│ +Search) │
│ RDEPUBResourceURLSchemeHandler(ss-reader:// 协议) │
│ RDEPUBStyleSheetBuilder / RDEPUBJavaScriptBridge │
│ RDEPUBFixedLayoutTemplate / RDEPUBAssetRepository │
│ RDEPUBWebViewDebug(调试日志工具) │
│ │
│ Search 层 │
│ 搜索 │
│ RDEPUBSearchEngine(协议)/ RDEPUBHTMLSearchEngine │
│ RDEPUBSearchModels(SearchMatch/Result/State/Presentation)│
└───────────────────────────┬─────────────────────────────┘
│
┌───────────────────────────▼─────────────────────────────┐
│ EPUBTextRendering 层(文本 EPUB 渲染) │
│ RDEPUBTextRenderer(协议) │
│ RDEPUBDTCoreTextRenderer(DTCoreText 实现) │
│ RDEPUBTextRendererSupport / RDEPUBTextPaginationSupport │
│ RDEPUBTextBookBuilder / RDPlainTextBookBuilder │
│ RDEPUBTextLayouter / RDEPUBTextLayoutFrame │
│ RDEPUBTextBookCache / RDEPUBChapterData │
│ RDEPUBTextIndexTable / RDEPUBTextPerformanceSampler │
│ RDEPUBTextSearchEngine │
│ │
│ 渲染 │
│ RDEPUBTextRenderer(协议) │
│ RDEPUBDTCoreTextRenderer(DTCoreText 实现) │
│ RDPlainTextBookBuilder(纯文本书籍构建) │
│ RDEPUBTextPositionConverter(位置转换器) │
│ RDEPUBTextSearchEngine(文本搜索引擎) │
│ RDEPUBTextIndexTable / RDEPUBChapterData │
│ │
│ BuildPipeline/(构建管线) │
│ RDEPUBTextBookBuilder(分页书籍构建器) │
│ RDEPUBTextBookCache / RDEPUBTextBookModels │
│ RDEPUBTextBuildPipelineInterfaces(管线协议) │
│ RDEPUBPaginationCacheCoordinator(缓存协调) │
│ RDEPUBChapterTailNormalizer(章尾规范化) │
│ RDEPUBBuildDiagnosticsReporter(诊断报告) │
│ RDEPUBTextPerformanceSampler(性能采样) │
│ │
│ Pagination/(分页引擎) │
│ RDEPUBTextLayouter / RDEPUBTextLayoutFrame │
│ RDEPUBChapterPageCounter / RDEPUBCoreTextPageFrameFactory│
│ RDEPUBPageBreakPolicy(断页策略) │
│ RDEPUBTextPaginationInterfaces(分页协议) │
│ RDEPUBTextPaginationSupport(分页支持) │
│ │
│ Typesetter/(排版管线) │
│ RDEPUBTypesettingPipeline(排版管线编排) │
│ RDEPUBHTMLNormalizer(HTML 规范化) │
│ RDEPUBStyleSheetComposer(CSS 组合) │
│ RDEPUBFontNormalizer(字体规范化) │
│ RDEPUBAttachmentNormalizer(附件规范化) │
│ RDEPUBFragmentMarkerInjector(Fragment 标记注入) │
│ RDEPUBSemanticMarkerInjector(语义标记注入) │
│ RDEPUBRenderDiagnosticsCollector(渲染诊断) │
│ RDEPUBTextRendererSupport(渲染辅助工具) │
└──────────────────────────────────────────────────────────┘
```
@@ -92,14 +165,13 @@ RDReaderView 是一个 iOS 阅读器组件库(CocoaPods),提供开箱即
## 3. 翻页容器层(RDReaderView)
### 3.1 四种翻页模式
### 3.1 三种翻页模式
| 模式 | 实现方式 | 特点 |
|------|----------|------|
| `pageCurl` | UIPageViewController | 原生翻书效果,手势由系统提供 |
| `horizontalScroll` | UICollectionView + RDReaderFlowLayout | 每屏显示 2 项,水平分页滚动 |
| `verticalScroll` | UICollectionView + RDReaderFlowLayout | 全宽项目,垂直连续滚动 |
| `horizontalCoverScroll` | UICollectionView + RDReaderFlowLayout | 覆盖滚动效果,Z 轴动画 |
### 3.2 数据源协议