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
Coordinatorパターンの実践
Search
Yoshikuni Kato
March 22, 2017
Programming
2.9k
3
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Coordinatorパターンの実践
potatotips #38
SampleCode:
https://github.com/yoching/CoordinatorSample
Yoshikuni Kato
March 22, 2017
More Decks by Yoshikuni Kato
See All by Yoshikuni Kato
Fun of writing Unison
yoching
0
730
The Elm Architecture & Swift
yoching
0
1.3k
iOS developers community in Tokyo
yoching
0
980
Swiftエンジニアが海外のポジションに応募する
yoching
10
3.4k
App Architecture By Manual DI
yoching
0
940
Passing function to function arguments
yoching
0
980
「新規アプリの設計」を設計する
yoching
1
2.2k
App Architecture By Manual DI
yoching
2
640
関数を引数として渡す書き方のポイント
yoching
0
900
Other Decks in Programming
See All in Programming
Vue Fes Japan 2026 タイムテーブル徹底解説
448jp
0
120
The Good Stuff, Not the Slop: Engineering High-Quality Android Apps with Modern AI Tooling
danybony
1
250
LL言語やWebフレームワークのPostgreSQL対応 〜DBの機能がユーザーに届くまで〜
kentaroutakeda
1
150
海上で動くGoサーバー: goroutineとchannelでさばく航行データストリーム
atsuki_seo
0
520
新卒PdEのリアル
ryu1013
1
500
LoopHub - ローカルで動く GitHub で、AI と共同開発
jugyo
1
550
大喜利で理解するLLM as a Judge / Understanding LLM-as-a-Judge through Ogiri
rockname
0
100
新人はどこまで自力でやり、どこからAIに頼るべきか/エンジニア育成に向き合う_先輩たちの悩みと知見共有会
toppan_digital_dev
1
620
自分的「カンファレンスの楽しみ方」
syumai
0
200
20260914 AIエージェント時代のPlatform Engineering LLM基盤とプロダクトの責務境界線
kanfab1
6
1.8k
Building an Out-of-Order CPU
latte72
1
770
GraphRAGのKnowledge Graphを 直接!見る/View-GraphRAG's-KnowledgeGraph-directly!
tyumugi1113
1
310
Featured
See All Featured
How to Ace a Technical Interview
jacobian
281
24k
For a Future-Friendly Web
brad_frost
183
10k
So, you think you're a good person
axbom
PRO
2
2.2k
Amusing Abliteration
ianozsvald
1
300
SEO in 2025: How to Prepare for the Future of Search
ipullrank
3
3.8k
Navigating Weather and Climate Data
rabernat
0
520
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
8.3k
Jamie Indigo - Trashchat’s Guide to Black Boxes: Technical SEO Tactics for LLMs
techseoconnect
PRO
0
670
The agentic SEO stack - context over prompts
schlessera
0
940
Exploring the relationship between traditional SERPs and Gen AI search
raygrieselhuber
PRO
3
4.3k
Measuring Dark Social's Impact On Conversion and Attribution
stephenakadiri
2
280
Are puppies a ranking factor?
jonoalderson
2
3.9k
Transcript
Coordinatorύλʔϯͷ࣮ફ @yoshikuni_kato potato%ps #38 2017/03/22 1
Who am I? • Ճ౻༝܇ʢYoshikuni Katoʣ @yoshikuni_kato • iOSΤϯδχΞ •
Yahoo! Japan -> Φϋί • ʮϥδ͐ʯ͘Μ → • Interests: ઃܭ / FRP / Coordinator PaCern / UI࣮ 2
Agenda • Coordinatorύλʔϯͷ࣮ྫΛհ͍ͨ͠ • Coordinator: ը໘ભҠͷϩδοΫΛVC͔ΒΓग़ͨ͠ͷ • աڈͷࢿྉʢը໘ભҠͷཧͱMVVMʣΛࢀর͍ͩ͘͞ 3
ιʔείʔυ h"ps:/ /github.com/yoching/CoordinatorSample 4
5
6
Coordinatorͷ࡞୯Ґ • ʮதʹෳͷVCΛ࣋ͭVCʯ୯ҐͰCoordinatorΛ࡞Δͱ͔Γ ͍͢ • UINaviga0onController • UITabBarController • containerViewΛར༻͍ͯ͠ΔViewController
• UXతͳׂͱҰக͢Δͣ 7
Coordinator protocol protocol Coordinator { var presenter: UIViewController { get
} func start() } 8
Naviga&onCoordinator protocol protocol NavigationCoordinator: Coordinator { var navigationController: UINavigationController {
get } } extension NavigationCoordinator { var presenter: UIViewController { return navigationController as UIViewController } } 9
TabBarCoordinator protocol protocol TabBarCoordinator: Coordinator { var tabBarController: UITabBarController {
get } } extension TabBarCoordinator { var presenter: UIViewController { return tabBarController as UIViewController } } 10
AppCoordinator final class AppCoordinator { private let window: UIWindow private
let rootCoordinator: Coordinator init(window: UIWindow, rootCoordinator: Coordinator) { self.window = window self.rootCoordinator = rootCoordinator } func start() { rootCoordinator.start() window.rootViewController = rootCoordinator.presenter window.makeKeyAndVisible() } } 11
MainTabCoordinator final class MainTabCoordinator: TabBarCoordinator { let tabBarController: UITabBarController private
let childCoordinators: [Coordinator] init(presenter: UITabBarController, childCoordinators: [Coordinator]) { self.tabBarController = presenter self.childCoordinators = childCoordinators } func start() { childCoordinators.forEach { coordinator in coordinator.start() } tabBarController.setViewControllers( childCoordinators.map { $0.presenter }, animated: false ) } } 12
2ͭͷNaviga'onͰڞ௨͢ΔભҠ͕͋Δ • ભҠ ɹ→ protocol-orientedʹղܾ 13
DetailsPresentable protocol protocol DetailsPresentable { func showItemDetail(item: Item) func showUserDetail(user:
User) } 14
DetailsPresentable extension extension DetailsPresentable where Self: NavigationCoordinator { func showItemDetail(item:
Item) { let itemDetailVC = StoryboardScene.ItemDetailViewController.initialViewController() itemDetailVC.item = item itemDetailVC.userTapped = showUserDetail navigationController.pushViewController(itemDetailVC, animated: true) } func showUserDetail(user: User) { // ... } } ※ VC→Coordinatorͷ௨৴ɺclosureΛհ͢ / delegate / Observable(FRP) ͳͲ 15
FeedCoordinator final class FeedCoordinator: NavigationCoordinator, DetailsPresentable { let navigationController: UINavigationController
init(presenter: UINavigationController) { self.navigationController = presenter presenter.title = "Feed" } func start() { let feedViewController = StoryboardScene.FeedViewController.initialViewController() feedViewController.itemSelected = showItemDetail navigationController.pushViewController(feedViewController, animated: false) } } 16
Summary • Coordinatorͷ࡞ྫͷհ • h+ps:/ /github.com/yoching/CoordinatorSample • Ͳ͏ׂ͢Δ͔ • ڞ௨ॲཧΛprotocol-orientedʹղܾ͢Δ
17
Thank you! 18
ࢀߟ • ը໘ભҠͷཧͱMVVM • Presen)ng Coordinators by Soroush Khanlou, NSSpain(2015)
• Boundaries in Prac)ce by Nonaka Ayaka, try!SwiH(2016) • MVVM-C In Prac)ce by Steve ScoM, UIKonf(2016) • Connec)ng View Controllers at SwiH Talk(objc.io), 2016 19