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
[JAWS-UG横浜 #76] イケてるアップデートを宇宙いち早く紹介するよ!
maroon1st
0
450
RWC 2024 DICOM & ISO/IEC 2022
m_seki
0
200
テスト自動化失敗から再挑戦しチームにオーナーシップを委譲した話/STAC2024 macho
ma_cho29
1
1.3k
ブラウザ単体でmp4書き出すまで - muddy-web - 2024-12
yue4u
2
460
数十万行のプロジェクトを Scala 2から3に完全移行した
xuwei_k
0
260
CQRS+ES の力を使って効果を感じる / Feel the effects of using the power of CQRS+ES
seike460
PRO
0
110
急成長期の品質とスピードを両立するフロントエンド技術基盤
soarteclab
0
920
rails stats で紐解く ANDPAD のイマを支える技術たち
andpad
1
290
命名をリントする
chiroruxx
1
390
MCP with Cloudflare Workers
yusukebe
2
220
複雑な仕様に立ち向かうアーキテクチャ
myohei
0
170
Featured
See All Featured
Practical Orchestrator
shlominoach
186
10k
How STYLIGHT went responsive
nonsquared
95
5.2k
Automating Front-end Workflow
addyosmani
1366
200k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
169
50k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
26
1.5k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
48k
Docker and Python
trallard
42
3.1k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
232
17k
Measuring & Analyzing Core Web Vitals
bluesmoon
4
170
The Power of CSS Pseudo Elements
geoffreycrofte
73
5.4k
Faster Mobile Websites
deanohume
305
30k
Fashionably flexible responsive web design (full day workshop)
malarkey
405
66k
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 ‼