Fly Me to the
View
Jorge D. Ortiz-Fuentes
@jdortiz
A Canonical
Examples
Production
#AdvArchMobile
Agenda
★ Architecture & Responsibilities
★ A modular solution
• Storyboards
• XIBs only
★ Benefits
★ Recap
Persistance FW
View
Network
LocationFW
Presenter
Entity Gateway
Clean Architecture
Interactor
Entity
Where’s the beef?
navigation
201710 Fly Me to the View - iOS Conf SG
#AdvArchMobile
Navigation
★ Events vs Semantics
★ Storyboard vs Decoupled VC
★ And without storyboards?
★ Dependency Injection
★ Memory Management
Responsibili
ties
MVP
#AdvArchMobile
View
★ Known by its beautiful face
and its passivity
★ Receives the events and
passes them to the presenter
★ Knows how to navigate
#AdvArchMobile
Presenter
★ Provides meaning to the user
events
★ Tells the view what to update
★ Knows when and where to
navigate
#AdvArchMobile
Connector
★ Knows the dependencies and
how to connect them
★ Takes you to the next
connector
What about MVVM?
#AdvArchMobile
No worries
★ MVP Tells
★ MVVM Notifies
★ Feel free to embrace & extend
A modular
solution
Decoupling
#AdvArchMobile
View controller
★ Separate event from semantics
★ Still, navigation is done here
A new VC
View (VC) Presenter Interactor
Entity
Gateway
Connector
View (VC) Presenter Interactor
Entity
Gateway
Connector
1 23
4
Segue from VC
#AdvArchMobile
View Controller: Events
@IBAction func add(_ sender: UIBarButtonItem) {
presenter.addButtonTapped()
}
override func tableView(_ tableView: UITableView,
didSelectRowAt indexPath: IndexPath) {
presenter.select(row: indexPath.row)
}
#AdvArchMobile
Presenter: Navigation
Semantics
func addButtonTapped() {
view.navigateToAddProgrammer()
}
func select(row: Int) {
if row < 0 !|| row !>= programmers.count {
selectedId = nil
} else {
let programmer = programmers[row]
selectedId = programmer.id
view.navigateToProgrammerDetail()
}
}
#AdvArchMobile
View Controller:
Navigation
func navigateToAddProgrammer() {
performSegue(withIdentifier:
SegueIdentifier.addProgrammer, sender: self)
}
func navigateToProgrammerDetail() {
performSegue(withIdentifier:
SegueIdentifier.showProgrammer, sender: self)
}
#AdvArchMobile
View Controller:
Delegate DI
override func prepare(for segue: UIStoryboardSegue, sender:
Any?) {
let identifier = try! segueIdentifier(for: segue)
switch identifier {
case .addProgrammer:
connector.prepareAddProgrammer(viewController:
segue.destination)
case .showProgrammer:
connector.prepareProgrammerDetail(viewController:
segue.destination, presenter: presenter)
}
}
#AdvArchMobile
Child Connector:
Assemble
func assembleModule(view:
ProgrammerEditViewController) {
let presenter =
ProgrammerEditPresenter(otherDep: depencency)
view.presenter = presenter
view.connector = self
presenter.view = view
}
#MobAppArch
Implementing navigation
and back
★ Navigation destination is NOT decided by
the view event
★ When presented modally, navigation back
requires Unwind segue
★ In a navigation controller things happen
naturally
Memory
Management
Dismiss a VC
View (VC) Presenter Interactor
Entity
Gateway
Connector
View (VC) Presenter Interactor
Entity
Gateway
Connector
1 2
Passing parameters
#AdvArchMobile
Having the Information
★ Perform segue & prepare for segue are
disconnected
★ Information for injection:
• Use sender: DON’T
• State in View Controller
• State in Presenter (preferred)
XIBs only
#AdvArchMobile
Differences
★ Easier to pass the information
★ Easier to do the injection: Initializer instead
of property
★ Presentation is done by the source
★ No “big picture” or unwind segues
#AdvArchMobile
VC Injection
via Initializer
var presenter: ProgrammerEditPresenter
init(presenter: ProgrammerEditPresenter,
nibName: String? = nil, bundle: Bundle? =
nil) {
self.presenter = presenter
super.init(nibName: nil, bundle: nil)
presenter.view = self
}
#AdvArchMobile
Passing Information &
Presentation
func navigateToDetail(parameter: String) {
let detailViewController =
connector.prepareProgrammerDetail(paramete
r: parameter)
navigationController!?.pushViewController(d
etailViewController, animated: true)
}
Benefits
Modify Dependency
Injection
#AdvArchMobile
Dependencies Change
★ Create them in the connector
★ Pass them from one connector to the next
Testable
#AdvArchMobile
Test Everything
func testSegueToAddProgrammerInvokesConnectorToNavigate() {
let connectorMock = ProgrammersListConnectorMock(some
Dep: DepTestDummy())
sut.connector = connectorMock
sut.performSegue(withIdentifier:
ProgrammersTableViewControllerMock.SegueIdentifier.addProgr
ammer, sender: sut)
XCTAssertEqual(1,
connectorMock.prepareAddProgrammerInvoked)
}
A/B Testing
#AdvArchMobile
Presenter
func addButtonTapped() {
if abSelector.isA {
view.navigateToAddProgrammerA()
} else {
view.navigateToAddProgrammerB()
}
}
#AdvArchMobile
Recap
★ Navigation is a key part of an advanced
architecture:
• Modular
• Allows passive view
• Not bound to implementation (storyboards)
★ Easy to implement & maintain
★ Clear benefits
– Anonymous iOS developer
“Fly me to the View
Let me play among the Apps”
Thank
You!
谢谢
Terima
kasih!
ந"#
@jdortiz
#AdvArchMobile

More Related Content

PDF
iOS advanced architecture workshop 3h edition
PDF
Clean architecture workshop
PDF
Jorge D. Ortiz Fuentes "Hands on Implementation of Clean Architecture for And...
PDF
Android clean architecture workshop 3h edition
PPTX
VIPER ( ? OR : AND) MVVM
PDF
Ui design patterns
PDF
Delegateless Coordinator
PDF
Infinum iOS Talks #2 - VIPER for everybody by Damjan Vujaklija
iOS advanced architecture workshop 3h edition
Clean architecture workshop
Jorge D. Ortiz Fuentes "Hands on Implementation of Clean Architecture for And...
Android clean architecture workshop 3h edition
VIPER ( ? OR : AND) MVVM
Ui design patterns
Delegateless Coordinator
Infinum iOS Talks #2 - VIPER for everybody by Damjan Vujaklija

Similar to 201710 Fly Me to the View - iOS Conf SG (20)

PPTX
2010 - Basta: ASP.NET Controls für Web Forms und MVC
PPTX
MVP vs MVVM : a fast introduction
PPTX
Training: MVVM Pattern
PDF
Android App Architecture
PDF
Automation of PaaS at the edge
PPTX
Riacon swiz
PDF
oVirt Introduction
PDF
Devoxx 2018 - Pivotal and AxonIQ - Quickstart your event driven architecture
PDF
Container Days
PDF
ContainerDays NYC 2015: "Easing Your Way Into Docker: Lessons From a Journey ...
PPTX
Getting started vmware apps
PDF
Delegateless Coordinators - take 2
PDF
Odo improving the developer experience on OpenShift - hack &amp; sangria
PDF
Design & Development of Web Applications using SpringMVC
PDF
Swiz DAO
PDF
Pluggable web app using Angular (Odessa JS conf)
PDF
Docker + Microservices in Production
PPTX
London-MuleSoft-Meetup-April-19-2023
PPTX
BDD with CucumberJS and WebdriverIO
2010 - Basta: ASP.NET Controls für Web Forms und MVC
MVP vs MVVM : a fast introduction
Training: MVVM Pattern
Android App Architecture
Automation of PaaS at the edge
Riacon swiz
oVirt Introduction
Devoxx 2018 - Pivotal and AxonIQ - Quickstart your event driven architecture
Container Days
ContainerDays NYC 2015: "Easing Your Way Into Docker: Lessons From a Journey ...
Getting started vmware apps
Delegateless Coordinators - take 2
Odo improving the developer experience on OpenShift - hack &amp; sangria
Design & Development of Web Applications using SpringMVC
Swiz DAO
Pluggable web app using Angular (Odessa JS conf)
Docker + Microservices in Production
London-MuleSoft-Meetup-April-19-2023
BDD with CucumberJS and WebdriverIO
Ad

More from Jorge Ortiz (20)

PDF
Tell Me Quando - Implementing Feature Flags
PDF
Unit Test your Views
PDF
Control your Voice like a Bene Gesserit
PDF
Kata gilded rose en Golang
PDF
CYA: Cover Your App
PDF
Refactor your way forward
PDF
Home Improvement: Architecture & Kotlin
PDF
Architectural superpowers
PDF
Architecting Alive Apps
PDF
To Protect & To Serve
PDF
Escape from Mars
PDF
Why the Dark Side should use Swift and a SOLID Architecture
PDF
Dependence day insurgence
PDF
Architectural superpowers
PDF
TDD for the masses
PDF
7 Stages of Unit Testing in iOS
PDF
Building for perfection
PDF
TDD by Controlling Dependencies
PDF
Unit testing in swift 2 - The before & after story
PDF
Core Data in Modern Times
Tell Me Quando - Implementing Feature Flags
Unit Test your Views
Control your Voice like a Bene Gesserit
Kata gilded rose en Golang
CYA: Cover Your App
Refactor your way forward
Home Improvement: Architecture & Kotlin
Architectural superpowers
Architecting Alive Apps
To Protect & To Serve
Escape from Mars
Why the Dark Side should use Swift and a SOLID Architecture
Dependence day insurgence
Architectural superpowers
TDD for the masses
7 Stages of Unit Testing in iOS
Building for perfection
TDD by Controlling Dependencies
Unit testing in swift 2 - The before & after story
Core Data in Modern Times
Ad

Recently uploaded (20)

PDF
CCleaner 6.39.11548 Crack 2025 License Key
PDF
How AI/LLM recommend to you ? GDG meetup 16 Aug by Fariman Guliev
PPTX
Matchmaking for JVMs: How to Pick the Perfect GC Partner
PDF
How Tridens DevSecOps Ensures Compliance, Security, and Agility
PPTX
most interesting chapter in the world ppt
PDF
AI-Powered Threat Modeling: The Future of Cybersecurity by Arun Kumar Elengov...
PPTX
How to Odoo 19 Installation on Ubuntu - CandidRoot
PDF
BoxLang Dynamic AWS Lambda - Japan Edition
PDF
Wondershare Recoverit Full Crack New Version (Latest 2025)
PDF
AI/ML Infra Meetup | LLM Agents and Implementation Challenges
DOC
UTEP毕业证学历认证,宾夕法尼亚克拉里恩大学毕业证未毕业
PPTX
Full-Stack Developer Courses That Actually Land You Jobs
PDF
Type Class Derivation in Scala 3 - Jose Luis Pintado Barbero
PDF
iTop VPN Crack Latest Version Full Key 2025
PPTX
Trending Python Topics for Data Visualization in 2025
PDF
Workplace Software and Skills - OpenStax
PPTX
Computer Software - Technology and Livelihood Education
PPTX
Python is a high-level, interpreted programming language
PPTX
CNN LeNet5 Architecture: Neural Networks
DOCX
How to Use SharePoint as an ISO-Compliant Document Management System
CCleaner 6.39.11548 Crack 2025 License Key
How AI/LLM recommend to you ? GDG meetup 16 Aug by Fariman Guliev
Matchmaking for JVMs: How to Pick the Perfect GC Partner
How Tridens DevSecOps Ensures Compliance, Security, and Agility
most interesting chapter in the world ppt
AI-Powered Threat Modeling: The Future of Cybersecurity by Arun Kumar Elengov...
How to Odoo 19 Installation on Ubuntu - CandidRoot
BoxLang Dynamic AWS Lambda - Japan Edition
Wondershare Recoverit Full Crack New Version (Latest 2025)
AI/ML Infra Meetup | LLM Agents and Implementation Challenges
UTEP毕业证学历认证,宾夕法尼亚克拉里恩大学毕业证未毕业
Full-Stack Developer Courses That Actually Land You Jobs
Type Class Derivation in Scala 3 - Jose Luis Pintado Barbero
iTop VPN Crack Latest Version Full Key 2025
Trending Python Topics for Data Visualization in 2025
Workplace Software and Skills - OpenStax
Computer Software - Technology and Livelihood Education
Python is a high-level, interpreted programming language
CNN LeNet5 Architecture: Neural Networks
How to Use SharePoint as an ISO-Compliant Document Management System

201710 Fly Me to the View - iOS Conf SG