Send the link below via email or IMCopy
Present to your audienceStart remote presentation
- Invited audience members will follow you as you navigate and present
- People invited to a presentation do not need a Prezi account
- This link expires 10 minutes after you close the presentation
- A maximum of 30 users can follow your presentation
- Learn more about this feature in our knowledge base article
Transcript of BPStudy #46
Async calls in iOS
What's the problem?
From "MVC" to "MVCS"
Async-proof view controllers
Conclusion Introduction Async calls in iOS What's the problem? From "MVC" to "MVCS" Async-proof view controllers Conclusion Network Location (GPS) Apple Push Notification In App Purchase Media Playback Hard to chain Unpredictable timings Multithreading Working with async is HARD Too many types of codes in a single view controller! >< "Draw-Redraw" doesn't work on async codes Updating views So... Decouple "Domain Logic" from view controllers "Instanciate-Update-Layout" architecture "Draw-Redraw" code of views Draw = Instanciate
Layout Redraw = Deallocate
Layout Potential memory leak
CRASH Traditional (Web) MVC iOS MVC M odel
C ontroller What does "Controller" actually control? 2 different "Controller"s Model View Controller Use-case Controller (a.k.a. Service Layer) Application Controller to M odel
S ervice from "Patterns of EnterPrise Application Architecture", Martin Fowler Flow of views - Navigation
Flow of logics - Domain Logic We need Services for reusability
for testability "Instanciate-Update-Layout" view outlets Update = Update Instanciate = Instanciate Layout = Layout Instanciate Update Layout NO deadly deallocation / reinstanciation API request finished
Location changed device rotation Extra caution for Core Data usage in view controller Copy before using many-to-many Think before retaining Consider using value objects NEVER update without lock Thank you for listening!