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
Coordinators and memory management
Search
Charles-Henri DUMALIN
April 19, 2018
Programming
140
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Coordinators and memory management
A talk given at Cocoaheads Lille in April 2018.
Charles-Henri DUMALIN
April 19, 2018
Other Decks in Programming
See All in Programming
変化を抱擁するドキュメントの作り方 - ビジネスルール駆動開発がもたらす、コードとの新しい関係
ioki
2
130
Vibes Containers 〜AIで変わるコンテナ設計と運用〜
tkikuc
3
520
AIとGame Jamで、ゲームを完成させた話
takahirosaeki
0
120
[GoCon2026] When Goroutines Are Not Enough: Runtime Locality in High-Throughput Go
takehaya
6
1.7k
まだ間に合う!今年の夏こそSchemeのマクロ展開器を完全理解!
omasanori
0
650
MIZARU@SPAJAM2026 第二回予選
1901drama
0
110
FastAPI の並行処理モデルを完全に理解する
hoto17296
9
3.9k
Swift愛好会100回記念 第1回を振り返る
jollyjoester
0
120
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
170
20260828_品質と開発生産性を両立させる、AI時代のE2Eテストの考え方
magicpod
0
180
新人はどこまで自力でやり、どこからAIに頼るべきか/エンジニア育成に向き合う_先輩たちの悩みと知見共有会
toppan_digital_dev
1
590
thread_parallel_with_free-threaded_Python_and_NumPy.pdf
riku_sakamoto
0
260
Featured
See All Featured
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
400
New Earth Scene 8
popppiees
3
2.5k
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
1
730
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
660
The browser strikes back
jonoalderson
0
1.7k
Joys of Absence: A Defence of Solitary Play
codingconduct
1
500
A Soul's Torment
seathinner
7
3.6k
DBのスキルで生き残る技術 - AI時代におけるテーブル設計の勘所
soudai
PRO
68
57k
How GitHub (no longer) Works
holman
316
150k
Leveraging LLMs for student feedback in introductory data science courses - posit::conf(2025)
minecr
1
380
Have SEOs Ruined the Internet? - User Awareness of SEO in 2025
akashhashmi
0
490
Efficient Content Optimization with Google Search Console & Apps Script
katarinadahlin
PRO
1
840
Transcript
Coordinators and memory
We all have this ViewController → Layout → View State
management → Data fetching & persistance → Navigation
Why is this? → ViewController have an unclear role in
UIKit → Apple's vision of MVC is not matching our needs
What is MVC?
What are Apple's components of MVC?
Why does this not match our expectations? → Apple expects
us to do a local first app with CoreData → In this context their architecture makes perfect sense
MVVM to the rescue
MVVM to the rescue → The ViewController becomes just a
part of the view level
Remember our ViewController? → Layout: UIView → View State management:
UIViewController → Data fetching & persistance: ViewModel → Navigation: ????
None
EXAMPLE CASE
None
Introducing Coordinator
What does a Coordinator do? → Manages the navigation flow
→ Instanciates the controllers and injects dependencies
How does it do it? → It's a plain Swift
object → You do what you want with it → You just implement the Coordinator Protocol → You use delegation (or Reactive Programming) at the controller level
Anatomy of a Coordinator public protocol Coordinator { func start(animated:
Bool) }
class AppCoordinator { let window: UIWindow let navigationController: UINavigationController! let
homeController: HomeViewController! init(window: UIWindow) { self.window = window } } extension AppCoordinator: Coordinator { func start(animated: Bool) { homeController = HomeViewController.instanciateFromStoryboard() navigationController = UINavigationController(root: homeController) window.rootViewController = navigationController window.makeKeyAndVisible() } }
class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? var coordinator:
Coordinator! func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]? ) -> Bool { let window = UIWindow(frame: UIScreen.main.bounds) coordinator = AppCoordinator(window: window) coordinator.start(animated: false) self.window = window } }
class DetailCoordinator { let navigationController: UINavigationController let detailController: DetailViewController init(_
navigationController: UINavigationController) { self.navigationController = navigationController } } extension DetailCoordinator: Coordinator { func start(animated: Bool) { let detailController = DetailViewController.instanciateFromStoryboard() navigationController.pushViewController(detailController, animated: animated) } }
class AppCoordinator { let window: UIWindow let navigationController: UINavigationController! let
homeController: HomeViewController! var childCoordinator: Coordinator? init(window: UIWindow) { self.window = window } } extension AppCoordinator: Coordinator { func start(animated: Bool) { homeController = HomeViewController.instanciateFromStoryboard() homeController.delegate = self navigationController = UINavigationController(root: homeController) window.rootViewController = navigationController window.makeKeyAndVisible() } } extension AppCoordinator: HomeControllerDelegate { func didTouchDetailButton() { let coordinator = DetailCoordinator(_ navigationController: navigationController) coordinator.start() childCoordinator = coordinator } }
Yay we did it!
None
Wait what?! Beware the zombie Coordinators and UIViewControllers
None
What's the problem here ? → UIKit creates a strong
reference → But Coordinator should own it... → UIKit decides when the view is released
Play fair with UIKit → Don't fight it, embrace it
→ UIKit will always be there
None
None
None
! How do I let the parent Coordinator know that
the Coordinator is not needed anymore?
None
The lifecycle probe → When the ViewController is deallocated it
sends a message to the Coordinator → The Coordinator sends a message to its parent to be released
SO MUCH WORK
Meet Yui Github: CallMeSH/Yui
Yui streamlines the process → Conform to the protocol →
Follow the guidelines → You're done !
DEMO Time
Thank You Github: CallMeSH/Yui Twitter: @CallMeSH LinkedIn: Charles-Henri DUMALIN