Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

浅谈 iOS 应用架构 #6

Open
ShannonChenCHN opened this issue Oct 7, 2017 · 1 comment
Open

浅谈 iOS 应用架构 #6

ShannonChenCHN opened this issue Oct 7, 2017 · 1 comment
Labels

Comments

@ShannonChenCHN
Copy link
Owner

ShannonChenCHN commented Oct 7, 2017

  • 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 处理,那么如何保证复用性呢?
  • 结论
    • 没有银弹
    • 只有合适的架构,没有最好的架构
@ShannonChenCHN
Copy link
Owner Author

ShannonChenCHN commented Feb 28, 2018

网络层

  • 分页
  • 回调
  • loading、toast、错误提醒页
  • 缓存
  • 统一配置
  • 校验请求回来的数据
  • JSON 转 Model

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant