Skip to content
This repository was archived by the owner on Jan 22, 2025. It is now read-only.
This repository was archived by the owner on Jan 22, 2025. It is now read-only.

浅谈 iOS 应用架构 #6

@ShannonChenCHN

Description

@ShannonChenCHN
  • iOS 应用架构到底是什么?
  • 讨论架构要看哪些问题?
    • 解决什么问题
      • 规范
      • 解耦
      • 复用
    • 模块分层
      • View 层
      • 网络层
      • 数据存储层、动态化
      • 工具类、分类
  • 几种架构模式
    • MVC
    • MVCS
    • MVP
    • MVVM
    • VIPER
  • 几个小问题
    • 在 MVC 模式下,ViewController 到底是 View 还是 Controller?
    • 设计架构时的妥协:灵活性(更多的选择) VS. 规范性(更多的约束)
    • View 如何与 Model 解耦?
      • 协议/代理
      • 分类
      • ViewModel/Reformer
    • 是什么导致了Massive View Controller?
    • 如何给 Controller 减负?(核心:拆分 controller)
      • 迁移 UITableView 和 UICollectionView 的代理方法
      • 封装 view
      • 数据加工的逻辑交给 model 层处理
      • 拆分部分任务到 category 中
    • view 层的事件传递的最佳实践?
      • view 层次太多,传到 controller 的话,就会有很多胶水代码(delegate 或者 target-action、block、基于 responder chain 的事件传递等)
      • 如果一个页面中所有的 view 的事件都交给 controller 处理,那么如何保证复用性呢?
  • 结论
    • 没有银弹
    • 只有合适的架构,没有最好的架构

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions