Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
クライアント型iOSアプリのつくりかた
Search
Yusuke Ito
May 25, 2013
Programming
1.2k
4
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
クライアント型iOSアプリのつくりかた
Yusuke Ito
May 25, 2013
More Decks by Yusuke Ito
See All by Yusuke Ito
Macとオーディオ再生 2024/11/02
yusukeito
0
1.5k
おうちHackを取り入れた リノベーション事例
yusukeito
0
990
Server Side Swiftを しばらく運用してみた話
yusukeito
0
670
Swift からword2vecを 使ってみる
yusukeito
0
1.2k
Swift Outside the Box
yusukeito
1
2.9k
SwiftでgRPCとProtocolBuffersを使う
yusukeito
4
1.5k
Swift on Raspberry Pi でI2Cデバイスを使う
yusukeito
1
750
Isomorphic Swift
yusukeito
2
710
Swiftの値付きEnumをHackする
yusukeito
0
450
Other Decks in Programming
See All in Programming
Optunaを作ったときにやりたかったこと、その後 (2026/10/16, Optuna Meetup #3)
iwiwi
2
1.2k
Verilogで学ぶCPU自作入門
uyuki234
8
4.2k
PyConTW 2026 - AI Coding 不只是工具升級, 區域醫院醫療資訊系統協作開發與資訊團隊轉型實踐
cclai999
0
140
自サークルのIdPからログアウトできるようになるまで
taiseiue
1
140
オーケストレーション記述言語 Katari
yukikurage
0
160
AWS CDKのカスタムリソースでContinuum(旧Security Agent)を実装した話 | Implementing Continuum (formerly Security Agent) via AWS CDK Custom Resource
akihisaikeda
2
160
Zero-Tap Sign-In対応、結局何をすればいいの?
mitohato14
0
220
Railsバージョンを4倍にした話
optim
0
520
自作Discord音声botをLambda MicroVMsに移行した話 / Migrating My Discord Voice Bot to Lambda MicroVMs
akihisaikeda
0
140
AmebaブログはKMPから卒業します
kmars0605
0
210
APNsからLive Activityを開始する話
yumnumm
0
170
ジョジョの世界をXRで再現する
mofurune
0
180
Featured
See All Featured
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
460
The agentic SEO stack - context over prompts
schlessera
0
970
HDC tutorial
michielstock
2
970
SERP Conf. Vienna - Web Accessibility: Optimizing for Inclusivity and SEO
sarafernandez
2
1.6k
Discover your Explorer Soul
emna__ayadi
2
1.3k
How to Think Like a Performance Engineer
csswizardry
28
2.9k
KATA
mclloyd
PRO
35
16k
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
330
The Illustrated Children's Guide to Kubernetes
chrisshort
51
53k
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
1
640
Statistics for Hackers
jakevdp
799
230k
Git: the NoSQL Database
bkeepers
PRO
433
67k
Transcript
ΫϥΠΞϯτܕiOSΞϓϦ ͷͭ͘Γ͔ͨ Yusuke Ito, @novi_, Github: novi at ୈ4ճ iphone_dev_jp
౦ژiPhone/Macษڧձ
About me http://about.me/yusukeito @novi_, Github: novi ߴઐଔۀޙϑϦʔ WebͷελʔτΞοϓ͍͔ͭ͘ UI, UX
ͱ Cocoa(iOS)ͱMac 7͘Β͍
Agenda ࣮ྫ(Githubͷίʔυ) MVCͱσβΠϯύλʔϯ ։ൃϓϩηε
త খ͍͞νʔϜ(2,3ਓ)Ͱ ৽نiOSΞϓϦΛ ޮྑ͘ɺ҆શʹɺ͘ ͭ͘Δ͜ͱΛతͱ͢Δɻ (৽نࣄۀελʔτΞοϓΛλʔήοτ)
࣮ྫͱͻͳܗ LTAPIRequest Google it or https://github.com/novi/LTAPIRequest ࣮ίʔυࢀর iOS(Cocoa)ͷMVCʹ͍ͭͯษڧ͢ΔͨΊ ϑϨʔϜϫʔΫΛΘͳ͍߹ͷ࣮ྫΛఏڙ͢Δ ͨΊ
(σβΠϯ)ύλʔϯ ܦݧଇ͔ΒಘΒΕͨ͏·͍͘͘ͱࢥΘΕΔߟ͑ํͱ ࣮ ਖ਼ղෆਖ਼ղແ͍ Ϋϥεͷઃܭํ๏ɺΦϒδΣΫτͷࢀরؔͷ ࣋ͨͤํɺΛͯ͠ޮྑ͘ɺಡΈ͘͢ɺ͢Δ
ϑϨʔϜϫʔΫͱϥΠϒϥϦ ϥΠϒϥϦϑϨʔϜϫʔΫΫϥε(.m)ͷू·Γ ϑϨʔϜϫʔΫ࣮(.m)ʹՃ͑ͯઃܭσβΠϯύ λʔϯͷҙຯ߹͍͕ՃΘΔ e.g.) UIKit=ϑϨʔϜϫʔΫ=MVC͕͋Δ ϑϨʔϜϫʔΫͷϧʔϧʹैͬͯΞϓϦΛ࡞Δ e.g.) -layoutSubviews ͕ݺΕͨΒxx͢Δ
http://www.flickr.com/photos/naotakem/4570128498 σβΠϯύλʔϯͷॏཁੑ
σβΠϯύλʔϯͷత ͍͑͢ίʔυΛॻ͘ʹಡΈ͍͢ Έ͍͑͢ίʔυΛॻ͘ ఔΑ݁͘߹͞Ε͍ͯΔ(ີͰૈͰͳ͍தؒ) ϦϑΝΫλϦϯά͍͢͠ ςετ͍͢͠ मਖ਼͍͢͠ ॻ͘ͷʹख͕͔͔ؒΒͳ͍
iOS MVC Webͱҧͬͯεςʔτϑϧ(not εςʔτϨε) Model-View-ViewController (MVC)
MVCͱ Model View View Controller ߋ৽ ߋ৽ มߋ ίϯτϩʔϥ͕શମͷϑϩʔΛ੍ޚ มߋ
iOS, UIKitͰ... Model View Controller UIViewController, UINavigationController... NSString, NSDictionary, NSArray...
UIView, UITableView...
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 ͦΕͧΕ͕͖࣋ͭͷ͖࣋ͭ Ͱͳ͍ͷ ҹ=อ࣋(ࢀর)
ViewΛ࣋ͭ ModelΛ࣋ͭ Model Controller View ViewController͔Βݟͯ...
Model Controller View × × Model͔Βݟͯ... View࣋ͨͳ͍ ViewController࣋ͨͳ͍
ViewController࣋ͨͳ͍ ModelΛ࣋ͭ Model Controller View × View͔Βݟͯ...
Model Controller View ࠶ͼ: อ͔࣋Βߟ͑Δ ·ͱΊ
Model Controller View Ͳ͏ͬͯࢀরͷແ͍ΦϒδΣΫτಉ࢜ ͷϝιουΛݺͼग़͔͢ σϦήʔτ Target-Action ௨ KVO Callback
ϝιου (ϝοηʔδૹ৴)
Case Study2 ViewControllerͷࣄ͔Βߟ͑Δ ViewController͕͢Δ͜ͱɺ͠ͳ͍͜ͱΛϧʔϧԽ͢Δ ඞવతʹσβΠϯύλʔϯ͕ཁΔɾߟ͑Δ ϧʔϧΛ࡞ΕͦͷϧʔϧΛલఏʹͤ͟ΔΛಘͳ͍ ϧʔϧʹσβΠϯύλʔϯͰ͍͍
ViewController͕͢Δ͜ͱ NSNotificationCenter͔Β௨Λड͚औΔ KVOͰ௨Λड͚औΔ ModelΛอ࣋͢Δ ViewʹModelΛ͢(setModelName:DataSourceܦ༝Ͱ) ViewΛੜ(ΠϯελϯεԽ)͢Δ ViewͷΠϕϯτΛड͚औΔ(Target-ActionDelegate͔Β)
ViewController͕͠ͳ͍͜ͱ ωοτϫʔΫ͔ΒσʔλΛऔಘ͢Δ(ϦΫΤετͨ͠ ޙɺ௨σʔλΛड͚औΔ) σΟεΫʹอଘ͢Δ σʔλΛอ࣋͢Δ ೖྗ͞Εͨσʔλͷ͕ਖ਼͍͔͠ݕূ͢Δ (Ҏ্ͯ͢Model͕୲͢Δ)
σϦήʔτͷॻ͖͔ͨ ࠶ͼ: σϦήʔτύλʔϯ delegateͱ͍͏໊લΛΑ͘͏ dataSourceσϦήʔτͷύλʔϯ UITableViewUIScrollViewͷॻ͖͔ͨΛࢀߟʹ͢Δ
Target-Actionͷॻ͖͔ͨ ࠶ͼ: ͜Εύλʔϯ UIResponderΛܧঝ(Responder-Chainύλʔϯ) UIViewUIViewControllerUIResponderΛܧঝ ૹΔଆ(View): UIButton(<=UIControl) - addTarget:action:forControlEvents: TargetΛnilʹ͢Δ
ड͚ͱΔଆ(Controller): ↑Ͱ࣮ͨ͠actionͷϝιουΛ࣮͢Δ - (void)someAction:(id)sender
։ൃϓϩηε తͷͨΊʹiOSΞϓϦͷ։ൃϓϩηεʹ͍ͭͯύλ ʔϯԽͯ͠ΈΔ ։ൃϓϩηεͷύλʔϯ
త খ͍͞νʔϜ(2,3ਓ)Ͱ ৽نiOSΞϓϦΛ ޮྑ͘ɺ҆શʹɺ͘ ͭ͘Δ͜ͱΛతͱ͢Δɻ (৽نࣄۀελʔτΞοϓΛλʔήοτ)
։ൃϓϩηε ՝ ਓؒతͳ੍(ݸੑɺٕೳϨϕϧɺϞνϕʔγϣ ϯɺࣄελΠϧ)ΛͲ͏Γӽ͑Δ͔? աఔͰνʔϜΛҭͯΔ͜ͱ͕Ͱ͖Δ͔ աఔͰจԽΛ࡞Δ͜ͱ͕Ͱ͖Δ͔
୲ ίʔσΟϯά 1 or 2ਓ ྫ͑, Storyboard, ViewControllerͷਓ Model, View,
Utils, Manager, Networkͷਓ Ϟδϡʔϧ͝ͱ͚Δ
։ൃཧ ։ൃϑϩʔΛνʔϜͰཱ֬͢Δ ࿈བྷखஈ νϟοτϫʔΫ etc.... ༻ϑϨʔϜϫʔΫɺϥΠϒϥϦ υΩϡϝϯτIssueཧγεςϜ Google Docs, Github
Issues, Pivotal Tracker, etc...
ϑΟʔυόοΫ UXͷίΞʹͳΔେࣄͳػೳΛ͘࡞Δ த్ʹಈ͔ͳ͍ػೳΛͩΒͩΒ࣮͠ͳ͍ ग़དྷͨΒɺϦϦʔε͢Δ (νʔϜorςελʔ) ػೳΛϨϏϡʔ͢Δ
υΩϡϝϯτ ίʔυͱಉ͡Α͏ʹෛ࠴Ͱ͋Δ υΩϡϝϯτͷ ࡞ऀ͕Ξοϓσʔτ͢ΔΛ࣋ͭ ࡞ऀ͕Λ࣋ͨͳ͘ͳΔ߹յ͢ ΨΠυϥΠϯ·ͨςϯϓϨʔτΛ࡞
UIσβΠϯ ඞͣఆ͞ΕΔ࣮σʔλΛ༻ UX, UI͕ᐆດͳঢ়ଶͰϑϧػೳΛ࣮͠ͳ͍ จݴ࠷ॳ͔ΒͪΌΜͱߟ͑Δ
࣮ͷઃܭ কདྷ࣮͢Δ͔͠Εͳ͍ػೳͷઃܭ͢Δ ͨͩ͠ɺ࠷ॳͷϦϦʔεͰγϯϓϧͳػೳ ʹߜΔ ࣮ࡍʹςετίʔυΛॻ͔͘ʹؔΘΒͣςετ ͢ΔલఏͰઃܭ͢Δ(ςετ͍͢͠ઃܭ) ઌΛݟ͗ͨ͢ઃܭΛ͠ͳ͍ HTTP API, UI...,
Ϋϥε
ίʔσΟϯά ΨΠυϥΠϯΛ࡞ ίʔυϨϏϡʔ pull࣌ʹߦ͏ɺఆظతʹߦ͏(optional) DRY (Don’t Repeat Yourself) ͨͩ͠ҙࣝ͗͢͠ͳ͍ ϞδϡʔϧԽɺΫϥεԽ
όʔδϣϯཧ ϒϥϯνΛΓ͗͢ͳ͍ Storyboard͕ϚʔδͰ͖ͳ͍ 1ਓ͔͠৮Βͳ͍ͳͲ ϏϧυͰ͖ͳ͍ίʔυɺςετ(खorϓϩάϥϜ Ͱ)͍ͯ͠ͳ͍ίʔυίϛοτ͠ͳ͍ ίϛοτϩάͷΨΠυϥΠϯΛ࡞
֎෦ϥΠϒϥϦ ͍͗͢ͳ͍ (Podsศར͚ͩͲ...) 1ػೳ͚͔ͩ͠Θͳ͍ͷʹશ෦ೖΕͳ͚Ε ͳΒͳ͍ͷͳͲ→ସΛ୳͢orࣗͰॻ͘ ෭࡞༻ͷ͋Δͷ༻͠ͳ͍ ϝιουೖΕସ͑Λ͍ͯ͠ΔͷͳͲ ίʔυ͕͑ͳ͍ͷ༻͠ͳ͍
APIϑΝʔετ αʔϏεΛఆٛ (αʔόαΠυͷػೳɾ༷) RESTful API(=υΩϡϝϯτ)Λఆٛ αʔόʔαΠυͷϞοΫΛ࡞Δ(optional) ΫϥΠΞϯταΠυΞϓϦΛॻ͘ RESTful API ͷςετΛॻ͘
αʔόʔαΠυΛ࣮͢Δ
None