Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
iOS Architecture
Search
halfrost
August 25, 2016
Programming
0
250
iOS Architecture
halfrost
August 25, 2016
Tweet
Share
More Decks by halfrost
See All by halfrost
Segment Tree Basics
halfrost
0
940
Redis multi-data center two-way synchronization
halfrost
0
580
Redis design ideas and usage specifications
halfrost
0
420
Golang message streaming practice in Eleme
halfrost
0
410
SQL practical optimization
halfrost
0
400
Fundamentals of Cryptography
halfrost
0
310
The practice of spatial index in geographic service
halfrost
0
400
Getting started with Machine Learning
halfrost
0
300
Functional Reactive Programming
halfrost
0
320
Other Decks in Programming
See All in Programming
The Evolution of Enterprise Java with Jakarta EE 11 and Beyond
ivargrimstad
1
510
Perlで痩せる
yuukis
1
680
Go Modules: From Basics to Beyond / Go Modulesの基本とその先へ
kuro_kurorrr
0
110
インターフェース設計のコツとツボ
togishima
2
690
実はすごいスピードで進化しているCSS
hayato_yokoyama
0
110
XSLTで作るBrainfuck処理系
makki_d
0
180
統一感のある Go コードを生成 AI の力で手にいれる
otakakot
0
2.8k
関数型まつり2025登壇資料「関数プログラミングと再帰」
taisontsukada
2
740
FastMCPでMCPサーバー/クライアントを構築してみる
ttnyt8701
2
130
実践ArchUnit ~実例による検証パターンの紹介~
ogiwarat
2
240
從零到一:搭建你的第一個 Observability 平台
blueswen
1
770
PT AI без купюр
v0lka
0
220
Featured
See All Featured
Building an army of robots
kneath
306
45k
Making the Leap to Tech Lead
cromwellryan
134
9.3k
Visualization
eitanlees
146
16k
Faster Mobile Websites
deanohume
307
31k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
35
2.3k
Build The Right Thing And Hit Your Dates
maggiecrowley
36
2.7k
The Invisible Side of Design
smashingmag
299
50k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
233
17k
Raft: Consensus for Rubyists
vanstee
138
7k
The Power of CSS Pseudo Elements
geoffreycrofte
77
5.8k
Code Review Best Practice
trishagee
68
18k
Embracing the Ebb and Flow
colly
85
4.7k
Transcript
⽅创iOS 架构漫谈 于德志
Problem 代码复⽤率低 业务之间的差异性⼤ ⼯程内各个模块之间有相当⼀些 代码是拷⻉的,或者说仅仅是个 别参数不同,⼤体都相同的代 码,在⼯程中出现的太多,导致 app包的体积明显变⼤ 由于整个项⽬中可以公共的中间件或者组 件⽬前还⽐较少,导致⼀些业务之间差异
性本来不是很⼤,由于重⽤的东⻄少,导 致基本上所有业务都是新的,很多都是重 头开始,导致了开发效率低
Analysis 先看看现在的构架
Now
Actual
How to solve 业务之间差异性⼤ 提⾼代码复⽤率 分层 代码复⽤率低 改
How to solve 业务功能 分层化 组件化 层次结构 改
None
expect
How to solve
Layer View ViewModel 项⽬Model 图⽚ 项⽬名称 概要 上线状态 浏览次数 融资轮数
领域 融资⾦额 imgeURL name desclabel status browse count amount company Area company money
Layer View ViewModel 项⽬Model 群头像 群名称 最近消息 最近时间 imgeURL GroupName
lastmessage lastTime
Advantage 1.分层 UI和业务逻辑相互隔离 2.View可以复⽤ View可以被不⽤业务中复⽤ 不⽤业务的ViewModel通过业务不⽤来注⼊到View中 3.View可以相互灵活替换 View可以根据不同业务逻辑,可以替换成各个不同的 版本
None
Layer View ViewModel ProJectDetailModel imageViewModel userViewModel ProJViewModel …………
Problem 1.组件之间的依赖 组件之间可能有公共的数据源 2.组件之间有先后关系 组件之间可能存在相互调⽤的关系 3.UI之间相互关联 ……
Message Bus GroupViewModel 消息总线 ChatViewModel ChatListViewModel 发布群⼈数变更消息 订阅消息 订阅消息
Advantage 消息总线 数据库组件 ViewModel ViewModel ViewModel ViewModel ⽹络组件 Socket组件 利⽤中介者
模式,现实 完全解耦
Install 开发对应的ViewModel 下⼀个组件 配置消息总线 选择ViewModel 开发新组件 选择组件 开始 结束
summary 1.通过MVVM和组件化实现完全解耦,后期维护效率更⾼ 2.⼀个新业务需求的拆分 将新需求拆分成各个组件View/ViewModel的开发,完 成新需求只需要装配各个组件即可完成 3.开发效率⼤⼤提⾼ ……
Thanks!