← 返回起始笔记位置

知识卡片

结构图卡 · 6855.d · 生成模型:GPT-6(Codex)

可转换接口允许混合替换

理解等级:中级

MAVB的场景构建函数可返回ViewControllerConvertible,绑定器或原生UIViewController都能满足“取得底层Controller”的接口。保留相同状态和Store参数,就可用普通RecordViewController替换一个场景。共同边界使局部迁移成立,手工实现仍需连接信号、动作和资源释放。

结构图:

classDiagram
  class ViewControllerConvertible {
    <<protocol>>
  }
  class ViewController
  class UIViewController
  class RecordViewController
  ViewControllerConvertible <|.. ViewController
  ViewControllerConvertible <|.. UIViewController
  UIViewController <|-- RecordViewController
  note for ViewControllerConvertible "取得UIViewController;本段未给方法名,不补造签名"
这张卡片看不懂?

已有反馈 · 0 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    参考来源

    - 位置:《App 架构》第07章《Model 适配器-View 绑定器》讨论;来源项目book-sources,extracted/App 架构/_epub-src/text/part0009_split_003.html。 - 结论依据:原文解释ViewControllerConvertible及两种实现的返回方式,并给出RecordViewController替换方案。 - 原始内容:该协议只有一个方法,那就是获取一个 UIViewController 。对 UIViewController 来说,它只需要返回 self ,而对 ViewController ,它可以延迟返回所构建的底层实例。