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
660
おうちHackを取り入れた リノベーション事例
yusukeito
0
660
Server Side Swiftを しばらく運用してみた話
yusukeito
0
570
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
660
Isomorphic Swift
yusukeito
2
590
Swiftの値付きEnumをHackする
yusukeito
0
310
Other Decks in Programming
See All in Programming
shadcn/uiを使ってReactでの開発を加速させよう!
lef237
0
370
watsonx.ai Dojo #6 継続的なAIアプリ開発と展開
oniak3ibm
PRO
0
260
Pythonでもちょっとリッチな見た目のアプリを設計してみる
ueponx
0
160
ISUCON14公式反省会LT: 社内ISUCONの話
astj
PRO
0
140
チームの立て直し施策をGoogleの 『効果的なチーム』と見比べてみた
maroon8021
0
210
Scaling your build logic
antalmonori
1
140
ErdMap: Thinking about a map for Rails applications
makicamel
1
1.1k
Запуск 1С:УХ в крупном энтерпрайзе: мечта и реальность ПМа
lamodatech
0
980
DMMオンラインサロンアプリのSwift化
hayatan
0
230
DevinとCursorから学ぶAIエージェントメモリーの設計とMoatの考え方
itarutomy
1
470
振り返れば奴(Cline)がいる
keiyagi
0
110
月刊 競技プログラミングをお仕事に役立てるには
terryu16
1
1.2k
Featured
See All Featured
No one is an island. Learnings from fostering a developers community.
thoeni
19
3.1k
What's in a price? How to price your products and services
michaelherold
244
12k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
44
9.4k
Rebuilding a faster, lazier Slack
samanthasiow
79
8.8k
Thoughts on Productivity
jonyablonski
68
4.4k
The Power of CSS Pseudo Elements
geoffreycrofte
74
5.4k
The World Runs on Bad Software
bkeepers
PRO
66
11k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
28
4.5k
Typedesign – Prime Four
hannesfritz
40
2.5k
Keith and Marios Guide to Fast Websites
keithpitt
410
22k
Mobile First: as difficult as doing things right
swwweet
222
9.1k
The Straight Up "How To Draw Better" Workshop
denniskardys
232
140k
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 ‼