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 App デザインパターン 基礎編
Search
Yusuke Ito
February 20, 2012
Programming
15
4.1k
iOS App デザインパターン 基礎編
Yusuke Ito
February 20, 2012
Tweet
Share
More Decks by Yusuke Ito
See All by Yusuke Ito
Macとオーディオ再生 2024/11/02
yusukeito
0
520
おうちHackを取り入れた リノベーション事例
yusukeito
0
650
Server Side Swiftを しばらく運用してみた話
yusukeito
0
560
Swift からword2vecを 使ってみる
yusukeito
0
1k
Swift Outside the Box
yusukeito
1
2.4k
SwiftでgRPCとProtocolBuffersを使う
yusukeito
4
1.3k
Swift on Raspberry Pi でI2Cデバイスを使う
yusukeito
1
650
Isomorphic Swift
yusukeito
2
590
Swiftの値付きEnumをHackする
yusukeito
0
300
Other Decks in Programming
See All in Programming
モバイルアプリにおける自動テストの導入戦略
ostk0069
0
110
Итераторы в Go 1.23: зачем они нужны, как использовать, и насколько они быстрые?
lamodatech
0
750
Mermaid x AST x 生成AI = コードとドキュメントの完全同期への道
shibuyamizuho
0
160
ドメインイベント増えすぎ問題
h0r15h0
2
300
The Efficiency Paradox and How to Save Yourself and the World
hollycummins
1
440
短期間での新規プロダクト開発における「コスパの良い」Goのテスト戦略」 / kamakura.go
n3xem
2
170
ゆるやかにgolangci-lintのルールを強くする / Kyoto.go #56
utgwkk
1
370
【re:Growth 2024】 Aurora DSQL をちゃんと話します!
maroon1st
0
770
命名をリントする
chiroruxx
1
400
rails stats で紐解く ANDPAD のイマを支える技術たち
andpad
1
290
StarlingMonkeyを触ってみた話 - 2024冬
syumai
3
270
Security_for_introducing_eBPF
kentatada
0
110
Featured
See All Featured
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
656
59k
Testing 201, or: Great Expectations
jmmastey
40
7.1k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
95
17k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
111
49k
Building Flexible Design Systems
yeseniaperezcruz
327
38k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.3k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
38
1.9k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
330
21k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
232
17k
Reflections from 52 weeks, 52 projects
jeffersonlam
347
20k
Imperfection Machines: The Place of Print at Facebook
scottboms
266
13k
Fontdeck: Realign not Redesign
paulrobertlloyd
82
5.3k
Transcript
iOS App σβΠϯύλʔϯ #1 Yusuke Ito
http://www.flickr.com/photos/naotakem/4570128498 σβΠϯύλʔϯͷॏཁੑ
σβΠϯύλʔϯͷॏཁੑ ϑϨΩγϒϧɾָʹมߋՄೳ Ϧʔϯ(ΞδϟΠϧ)։ൃָ͕ʹ ίʔυͷՄಡੑͷ্ εύήοςΟԽͷࢭ ύϑΥʔϚϯεͷ্ɾϝϞϦϦʔΫͷࢭ ...͕ظͰ͖Δ
iOS AppͷΞʔΩςΫνϟ Model-View-Controller(MVC)Λ౿ऻ Rails(Ruby)ͷαʔόαΠυWebΞϓϦͱશ͘ҧ͏ (WebΞϓϦ→iOSҠߦͷਓҙ) Կ͕Ұ൪͍͔ۙ→NextSTEP ͦΜͳΜΔ͔!! iOSͷจԽΛΔඞཁ͕͋Δɻ MVCվΊModel-View-ViewController
ͦͷલʹMVCͱ Model View Controller ߋ৽ ߋ৽ มߋ ίϯτϩʔϥ͕શମͷϑϩʔΛ੍ޚ มߋ
iOS, UIKitͰ... Model View Controller UIViewController, UINavigationController... NSString, NSDictionary, NSArray...
UIView, UITableView...
Bad pattern #1 Model Controller View View View View Controller
Controller Controller View View View Model Model Model Model Model
Bad pattern #2 View View View View View View View
Model Model Model Model Model Model Controller View View
Better pattern Model Controller View Model Controller View Model Controller
View
UIKitجຊύλʔϯ ௨(NSNotificationCenter) σϦήʔτ(NSTableViewDelegateͳͲ) λʔήοτɾΞΫγϣϯ(UIControlͳͲ, -addTarget:) Ωʔࢹ(Key-Value-Observing) ※ͯ͢Objective-Cͷݴޠ༷Ͱͳ͘ɺ ύλʔϯͷҰछ KVOඍົ͚ͩͲ...
Case Study อ͔࣋Βߟ͑Δ ΦϒδΣΫτ͕ΦϒδΣΫτΛอ࣋͢Δ/͠ͳ͍ ͱ͍͏͜ͱ(ʹࢀরΛ࣋ͭ, Reference) ʹ͍ͭͯϧʔϧΛ࡞Δ ඞવతʹσβΠϯύλʔϯ͕ཁΔɾߟ͑Δ ϧʔϧΛ࡞ΕͦͷϧʔϧΛલఏʹͤ͟ΔΛಘͳ͍ ϧʔϧʹσβΠϯύλʔϯͰ͍͍
࠶ͼModel-View-ViewController Model: NSObject͔Β࡞Δ, NSDictionary, NSArray... View: UIViewͷαϒΫϥεͯ͢(UITableView, UIButton, UIScrollView...) ViewController:
UIViewController, UINavigationViewController, UITabViewController...
Model-View-ViewController ͦΕͧΕ͕͖࣋ͭͷ͖࣋ͭ Ͱͳ͍ͷ ҹ=อ࣋(ࢀর)
Model Controller View × × Model͔Βݟͯ... View࣋ͨͳ͍ ViewController࣋ͨͳ͍
ViewController࣋ͨͳ͍ Modelجຊ࣋ͨͳ͍ Viewʹදࣔ͢Δඞཁ͕͋Δ ͷ͚ͩ࣋ͭ Model Controller View × × View͔Βݟͯ...
ViewΛ࣋ͭ ModelΛ࣋ͭ Model Controller View ViewController͔Βݟͯ...
Model Controller View ࠶ͼ: อ͔࣋Βߟ͑Δ ·ͱΊ
Model Controller View Ͳ͏ͬͯࢀরͷແ͍ΦϒδΣΫτಉ࢜ ͷϝιουΛݺͼग़͔͢ σϦήʔτ Target-Action ௨ KVO ϝιου
(ϝοηʔδૹ৴)
σϦήʔτͷॻ͖͔ͨ ࠶ͼ: σϦήʔτύλʔϯ delegateͱ͍͏໊લΛΑ͘͏ dataSourceσϦήʔτͷύλʔϯ UITableViewUIScrollViewͷॻ͖͔ͨΛࢀߟʹ͢Δ
Target-Actionͷॻ͖͔ͨ ࠶ͼ: ͜Εύλʔϯ UIResponderΛܧঝ(Responder-Chainύλʔϯ) UIViewUIViewControllerUIResponderΛܧঝ ૹΔଆ(View): UIButton(<=UIControl) - addTarget:action:forControlEvents: TargetΛnilʹ͢Δ
ड͚ͱΔଆ(Controller): ↑Ͱ࣮ͨ͠actionͷϝιουΛ࣮͢Δ - (void)someAction:(id)sender
σβΠϯύλʔϯͷशಘ ʹจষͱಉ͡ ಡΉ: ࣗͷίʔυɾGithub(ଞਓ)ͷίʔυɾࣗͷ աڈͷίʔυ ॻ͘: ίʔσΟϯάɾϦϑΝΫλϦϯάɾ৭ʑͳύ λʔϯΛࢼ͢
͓͢͢Ίใݯ Apple ެࣜυΩϡϝϯτ WWDC2010-2011 ϏσΦͱεϥΠυ Dynamic Objective-C / Լ
/ ຊ iOS։ൃʹ͓͚ΔύλʔϯʹΑΔΦʔτϚςΟζϜ / Լ / ຊ
εϥΠυ http://bit.ly/xZ7NsF ίʔσΟϯάΨΠυϥΠϯͷ http://yusukeito.me/post/16447745113 https://github.com/novi Thank You ‼