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
Application Coordinator
Search
Alexander Saenko
February 23, 2019
Programming
55
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Application Coordinator
Anton Hudz
Alexander Saenko
February 23, 2019
More Decks by Alexander Saenko
See All by Alexander Saenko
WWDC2020 Summary
alexandersaenko
0
200
Legacy code - methodology
alexandersaenko
0
87
Экологически чистая разработка
alexandersaenko
0
97
Альманах менеджера
alexandersaenko
0
49
Сам себе режиссер: по ту сторону iOS
alexandersaenko
0
52
Укрощение нормализированного состояния
alexandersaenko
0
99
Fastlane - App automation done right
alexandersaenko
0
97
Готовим своё хранилище сборок
alexandersaenko
0
55
PDD - Playground Driven Development 👨🏻_💻
alexandersaenko
0
120
Other Decks in Programming
See All in Programming
半永久的に提供し続けられるプライベートクラウドを目指して ― 利用者の認知負荷を抑えるAPI抽象化とハードウェア世代交代の基盤設計
tomokon
0
500
UnityでSystem.Net.WebSocketsなWebSocketサーバが動かないのでUnity Monoのコードを覗いてみた / about implementing websocket server with unity mono
drumath2237
1
610
Simple Storage Service(S3) is not simple
iwatsukayura
0
290
外から家のPCの電源入れたい!をPHPで解決する
kawashimo0
1
130
作れる、でも消せるか?──安全に「枯らして消す」機能削除術 / Drain, Then Delete
chobishiba
2
640
FactoryBotをやめればRSpecは速くなるのか?
yuta_onishi_97
0
290
UPDATE をやめる — EF Core でマスタをバージョン管理する
panda728
PRO
0
1.2k
ActionController meets Protocol Buffers
sorah
0
520
カツオ、ご期待ください
suneo3476
0
190
Workers Cache を知る
syumai
0
360
SREの越境 / SRE Collaboration
y0hgi
2
310
AWS CDKのカスタムリソースでContinuum(旧Security Agent)を実装した話 | Implementing Continuum (formerly Security Agent) via AWS CDK Custom Resource
akihisaikeda
2
150
Featured
See All Featured
Have SEOs Ruined the Internet? - User Awareness of SEO in 2025
akashhashmi
0
520
Efficient Content Optimization with Google Search Console & Apps Script
katarinadahlin
PRO
1
930
Java REST API Framework Comparison - PWX 2021
mraible
34
9.8k
Ethics towards AI in product and experience design
skipperchong
2
430
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
16
2.2k
The Curious Case for Waylosing
cassininazir
1
570
The Hidden Cost of Media on the Web [PixelPalooza 2025]
tammyeverts
2
530
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
430
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
2.1k
Paper Plane
katiecoart
PRO
5
54k
The Invisible Side of Design
smashingmag
301
52k
Become a Pro
speakerdeck
PRO
31
6.3k
Transcript
Application Coordinator Anton Hudz iOS Developer @ Riseapps
Agenda • Common problems • Definition • Responsibilities • How
to use • Sample • Links
Common problems Massive AppDelegate
Common problems Massive View Controllers with too many responsibilities
Definition VC A VC B VC C
Definition VC A VC B VC C Coordinator
Definition Coordinator 1 Coordinator 2 Coordinator 3 Application Coordinator Child
Coordinator 1 Child Coordinator 2
Responsibilities - Coordinator • Navigate controllers • Model mutation
Responsibilities - Controller • Fetch data • Transform it to
present • Display it • Notify coordinator
How to use • New or existing project • Group
your project by flows • Flow -> Coordinator
Sample - AppDelegate class AppDelegate: UIResponder, UIApplicationDelegate { var window:
UIWindow? private let coordinatorFactory = CoordinatorFactory() private lazy var applicationCoordinator: ApplicationCoordinatorOutput = self.make func application(_ application: UIApplication, didFinishLaunchingWithOptions laun configureWindow() return true } } extension AppDelegate { private func configureWindow() { window = UIWindow(frame: UIScreen.main.bounds) applicationCoordinator.start() } private func makeApplicationCoordinator() -> ApplicationCoordinatorOutput { return self.coordinatorFactory.makeApplicationCoordinator(window: window!) } }
Sample - ApplicationCoordinator func start() { window.makeKeyAndVisible() runFlow1() } private
func runFlow1() { let flow1Coordinator = coordinatorFactory.makeFlow1Coordinator(navigationController: flow1Coordinator.finishFlow = { [weak self, weak flow1Coordinator] in self?.removeDependency(flow1Coordinator) self?.runFlow2() } addDependency(flow1Coordinator) flow1Coordinator.start() } private func runFlow2() { let flow2Coordinator = coordinatorFactory.makeFlow2Coordinator(navigationController: flow2Coordinator.finishFlow = { [weak self, weak flow2Coordinator] in self?.removeDependency(flow2Coordinator) self?.runFlow1() } addDependency(flow2Coordinator) flow2Coordinator.start() }
Sample - Flow Coordinator func start() { showB() } }
extension Flow2Coordinator { private func showB() { let controllerBOutput = factory.makeControllerB() controllerBOutput.onFinishFlow = { [weak self] in self?.finishFlow?() } controllerBOutput.onNext = { [weak self] in self?.showC() } router.setRoot(module: controllerBOutput) } private func showC() { let controllerCOutput = factory.makeControllerC() controllerCOutput.onBack = { [weak self] in self?.router.popModule(animated: true) } router.push(controllerCOutput, animated: true, completion: nil) } }
Sample - Controller protocol ControllerBOutput: BaseViewType { var onFinishFlow: (()
-> Void)? { get set } var onNext: (() -> Void)? { get set } } final class ControllerB: BaseViewController, ControllerBOutput { var onFinishFlow: (() -> Void)? var onNext: (() -> Void)? @IBAction private func nextAction() { onNext?() } @IBAction private func finishFlowAction() { onFinishFlow?() } }
Origin links: • http://khanlou.com/2015/10/coordinators-redux/ • https://github.com/AndreyPanov/ApplicationCoordinator My demo project: https://github.com/hudzanton/ApplicationCoordinator
Links
?