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
ReactiveCococaのMVVMで綺麗なコードができるのか.pdf
Search
Tomohisa Takaoka
June 27, 2014
Technology
3.5k
4
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
ReactiveCococaのMVVMで綺麗なコードができるのか.pdf
Tomohisa Takaoka
June 27, 2014
More Decks by Tomohisa Takaoka
See All by Tomohisa Takaoka
変わらないものが、変わるものを決める — 意図駆動開発 × イベントソーシング × イミュータブル | What Doesn't Change Decides What Can — IDD × Event Sourcing × Immutability
tomohisa
0
2k
AI時代に設計が 最大の生産性レバーになる 意図駆動開発とデータを消さない設計|Don't Delete Your Data or Your Intent — Design as the Deepest Lever in the AI Era
tomohisa
1
1.8k
AIコーディングの理想と現実 2026 | AI Coding: Expectations vs. Reality 2026
tomohisa
0
1.7k
Sekibanのコアを5言語で動かす ― イベントソーシング×WASMでやってみた | Running Sekiban's Core in 5 Languages — Event Sourcing × WASM
tomohisa
0
150
Sekiban + Microsoft Orleans のアクターをAWS対応しました / Sekiban + Microsoft Orleans actors are now supported on AWS.
tomohisa
0
220
純粋なイミュータブルモデルを設計してからイベントソーシングと組み合わせるDeciderの実践方法の紹介 /Introducing Decider Pattern with Event Sourcing
tomohisa
1
3.1k
.NET Conf 2025 の興味のあるセッ ションを復習した / dotnet conf 2025 quick recap for backend engineer
tomohisa
0
210
dnx で実行できるコマンド、作ってみました
tomohisa
0
320
AIと協働し、イベントソーシングとアクターモデルで作る後悔しないアーキテクチャ Regret-Free Architecture with AI, Event Sourcing, and Actors
tomohisa
8
43k
Other Decks in Technology
See All in Technology
AIがGISを代替する日:〜すべてをAIが創る時代に、私たちがFOSS4Gに関わる意味〜
lehupa
0
130
視野はAIに、視座は人に / ai-for-breadth-humans-for-perspective
nkzn
5
2.5k
Content Mapper APIの応用例~CSS Modules、言語ファイル~
uhyo
2
370
AX時代の自治体支援リソース再配分と役割分担の再構成:戦略とロードマップ(概要)
sishi2026
0
130
仕様駆動開発の、その先へ。決める力と確かめる仕組み
inariku
1
140
ひとりで始めた AI駆動開発、チームに広げて何が変わったのか
kenichiodo
1
160
増え続けるプロダクトの品質をどう担保するか。ProductSpecとTypeScriptによる取り組み
joere
2
250
Flutter Widget Previewerで始めるUIプレビューとVRTの自動化
sakusaku3939
0
180
re:Inventで、人生は変わったのか? / growth-builders-hub-1-reinvent-2026
mhrtech
2
170
アクセラレーターで実現するServiceNow活用の高速化 / ServiceNow World Forum 2026
visional_engineering_and_design
0
100
[re:Invent2026事前勉強会(有志開催)]続きは、ラスベガスの廊下で / continue-in-the-vegas-hallway
sh_fk2
0
430
新卒エンジニア、 介護士になる
ryu1013
1
580
Featured
See All Featured
Mind Mapping
helmedeiros
1
420
Building Applications with DynamoDB
mza
96
7.3k
End of SEO as We Know It (SMX Advanced Version)
ipullrank
3
4.5k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.9k
Darren the Foodie - Storyboard
khoart
PRO
4
4k
Design in an AI World
tapps
1
380
Building a Scalable Design System with Sketch
lauravandoore
464
34k
Everyday Curiosity
cassininazir
0
380
The SEO Collaboration Effect
kristinabergwall1
1
610
Future Trends and Review - Lecture 12 - Web Technologies (1019888BNR)
signer
PRO
0
3.8k
Learning to Love Humans: Emotional Interface Design
aarron
275
41k
Marketing to machines
jonoalderson
1
5.9k
Transcript
ReactiveCococaͷMVVMͰ៉ ྷͳίʔυ͕Ͱ͖Δͷ͔ @tomohisa Tomohisa Takaoka 2014/6/27
None
डୗ։ൃ ʴ ΤϯλʔϓϥΠζ J-Tech Creations, Inc www.jtechs.com follow me @tomohisa
ຊͷεϖγϟϧίϯςϯπ Twitter @tomohisa ͔ΒͲ͏ͧ follow me @tomohisa
iOSΞϓϦͷ։ൃख๏ MVCύλʔϯ
•View - xib, Storyboard •Controller - UIViewController •Model (ಠࣗʹ࡞͢Δ) https://developer.apple.com/jp/devcenter/ios/library/japanese.html
͜ͷυΩϡϝϯτ͕ྑ͍ײ͡ͰMVCΛઆ໌͍ͯ͠·͢
ViewController͕େ͖͘ͳΓ͗͢Δʂ ※OSXʹɺCocoaόΠϯσΟϯάͱ͍͏ ViewͱσʔλΛ݁߹ͤ͞Δػೳ͕͋Δ͕ɺ iOSʹଘࡏ͠ͳ͍
ࣾ༻ͷλΠϜγʔτཧΞϓϦ
Background : parse.com ϢʔβʔཧͳͲͬͯ͘ΕΔ
ViewControllerʹσʔλऔಘͷίʔυ͕ͪ͝Ό·ͥ vVC (ංେԽͨ͠Ϗϡʔίϯτϩʔϥʔ)ʹͳͬͯ͠·ͬͨ
ReactiveCocoa Λͬͯ MVVM ʹॻ͖͑Δ
ReactiveCocoaͱʁ Function Reactive Programming (FRP) ΛObjective-CͰ࣮ݱ͢ΔͨΊͷϑϨʔϜϫʔΫ https://github.com/ReactiveCocoa/ReactiveCocoa
http://maoe.hatenadiary.jp/entry/20100109/1263059731
MVVMͱ http://www.teehanlax.com/blog/model-view-viewmodel-for-ios/
MVC MVVM ViewControllerɺେ͖ͳҙຯͰͷ VʹؚΉ
M V VM Model ViewController + IB ViewModel
M V VM Model 1.
Ϟσϧͷํ๏ View, ViewModel͔Β͢Δ
Ϟσϧͷํ๏̍ σʔλ(JSONͳͲͰදݱ͞ΕΔΦϒδΣΫτ) ֤σʔλΛද͢ΫϥεΛ࡞Δ JSON, XML, ParseObject ͳͲͷ DictionaryΞΫηεΛແ͘͢ ͪΌΜͱܕΛ࡞Δ σʔλʹ༝དྷ͢ΔϩδοΫ͜͜ʹॻ͘
ʢྫ͑̎ͷڑΛٻΊͨΓɺΦϒδΣΫτͰܭࢉ͠ ͨΓ͢Δ͍͋ʣ
worktime[“startedTime”] = [NSDate date]; worktime.startedTime = [NSDate date]; × ◦
Ϟσϧͷํ๏̎ σʔλͷಡΈॻ͖ͳͲڞ௨Ͱ͑Δػೳ (Downloader, Uploader, Calculator, Aggregator) ! σʔλͷશମ͔ΒΞϓϦͰूܭ͍ͨ͠ͳͲ μϯϩʔυ͢ΔػೳͳͲ ※parse
sdkʹඞཁͳػೳ͕͋ͬͨͷͰࠓճ࡞ͤͣ
Ϟσϧͷํ๏̏ ΞϓϦʹ݁߹͢Δͷ (ઃఆϑΝΠϧɺConstͳͲ) AppDelegateʹmodelϑΝΠϧΛ࣋ͨͤΔ AppDelegateʹͪ͝Όͪ͝Ό͔͔ͳ͍ʂ ΞϓϦͱͯ͠อ͍࣋ͯ͠Δσʔλ
͏ͱ͖ એݴ ΞϓϦʹ݁߹͢ΔmodelΛ࡞͢Δ
M V VM View Model 2.
https://github.com/ReactiveCocoa/ReactiveViewModel
None
RACCommand: ଞͷΦϒδΣΫτ͔Β࣮ߦग़དྷΔɻ ඇಉظॲཧͷ௨Λड͚Δ͜ͱՄೳ RACSignal: ௨ͷγάφϧΛड͚Δ͜ͱ͕Ͱ͖Δ KVOͰड͚औͬͨΒΓɺ௨ͷޙʹ͞Β ʹ࣍ͷ࡞ۀΛఆٛ͢Δ͜ͱՄೳ
M V VM View and ViewController 3.
ViewModelΛ࡞ͯ͠ɺViewModelͱViewΛόΠϯυ͢Δ
ϘλϯԡԼͷΠϕϯτΛViewModel ͷRACCommandͱؔ࿈͚Δ
ςΩετೖྗ࣌ʹViewModelͷσʔλΛߋ৽ ViewModelͰNoteͷߋ৽Λࢹ͠ɺߋ৽Λֻ͚Δ
ྑ͔ͬͨ •ViewModelʹUIίʔυ͕ͳ͍ͨΊɺUnitTest͕Մೳ •ViewModelʹStatusͳͲΛ࣋ͨͤɺදࣔΛௐ͢Δͷ͕ ༰қͦ͏ •ͦΕͧΕͷίʔυ͕͍ͯ͠ΔͷͰ͔Γ͍͢ •σʔλͷνΣοΫͳͲΛΈࠐΊΔ •εϨουͷཧͳͲ͕ߦΘΕ͍ͯΔͨΊɺόοΫάϥ ϯυͰUI͕มߋ͞ΕΔͳͲͷ͕͋·Γग़ͳͦ͞ ͏
Cons - ѱ͍ •ΊΜͲ͍͘͞ •Θ͔Γʹ͍͘ •ObjCͷػೳΛશ໘తʹ͍ͬͯΔͷͰɺSwift͚ͩͰͲ Ε͚ͩग़དྷΔͷ͔ʁ •ReactiveCocoaΛೖΕΔͱϓϩδΣΫτ͕ॏ͘ͳΔϏϧ υʹͨΒ͕͔͔࣌ؒΔ •ॳΊ͚ͯͩͲ·͔ͩΒͳ͍ڍಈ͕͋Δ
ɹʢ͔Δਓ͍ͨΒڭ͍͑ͯͩ͘͞ʣ
૯ׅɿ େنʹͳΕɺྑ͍ͷ͕ͭ͘Εͦ͏ɻ डୗ͕͍࣌͠ʹϓϩδΣΫτΛखͬ ͯͩ͘͞ΔϑϦʔϥϯε͞Μืूதʂ