SlideShare uma empresa Scribd logo
VIPER
DESIGN PATTERN
Padrão de projeto arquitetural
▪ Arquitetura "limpa"
▪ Divisão em módulos
▪ Princípio da responsabilidade única
VIPER - Design Pattern
class Car {
func accelerate() {}
func brake() {}
func turnLeft() {}
func turnRight() {}
func addFuel() {}
func changeOil() {}
func rotateTires() {}
}
class Car {
func accelerate() {}
func brake() {}
func turnLeft() {}
func turnRight() {}
func addFuel() {}
func changeOil() {}
func rotateTires() {}
func adjustDriverSeat() {}
func turnOnAC() {}
func playCD() {}
}
Violação do princípio
▪Um carro pode ser dirigido
▪Um carro deve receber manutenção
▪Um carro deve prover conforto
class DrivableCar {
func accelerate() {}
func brake() {}
func turnLeft() {}
func turnRight() {}
}
class MaintainableCar {
func addFuel() {}
func changeOil() {}
func rotateTires() {}
}
class ComfortableCar {
func adjustDriverSeat() {}
func turnOnAC() {}
func playCD() {}
}
protocol Drivable {
func accelerate() {}
func brake() {}
func turnLeft() {}
func turnRight() {}
}
protocol Maintainable {
func addFuel() {}
func changeOil() {}
func rotateTires() {}
}
protocol Comfortable {
func adjustDriverSeat() {}
func turnOnAC() {}
func playCD() {}
}
class Car: Drivable, Maintainable, Comfortable {
func accelerate() {}
func brake() {}
func turnLeft() {}
func turnRight() {}
func addFuel() {}
func changeOil() {}
func rotateTires() {}
func adjustDriverSeat() {}
func turnOnAC() {}
func playCD() {}
}
class Car: Drivable, Maintainable, Comfortable {
let drivable = DrivableCar()
let maintenable = MaintainableCar()
let confortable = ComfortableCar()
func accelerate() { drivable.accelerate() }
func brake() { drivable.brake() }
func turnLeft() { drivable.turnLeft() }
func turnRight() { drivable.turnRight() }
func addFuel() { maintenable.addFuel() }
func changeOil() { maintenable.changeOil() }
func rotateTires() { maintenable.rotateTires() }
func adjustDriverSeat() { confortable.adjustDriverSeat() }
func turnOnAC() { confortable.turnOnAC() }
func playCD() { confortable.playCD() }
}
VIPER - Design Pattern
View
View
▪ Mostra informações para o usuário
▪ Recebe comandos vindos do Presenter
sobre o que exibir
▪Detecta interações e notificar o Presenter
Presenter
Presenter
▪ Diz para a View o que ela deve executar
▪ Responsável por cuidar do estado da View
▪Recebe callbacks do Interactor
Interactor
Interactor
▪ Implementação dos casos de uso
▪ Integração com API, DB...
▪ Envia os dados recebidos externamente
para o Presenter realizar o tratamento
necessário antes de atualizar a View
▪O trabalho realizado pelo Interactor deve
ser independente de qualquer UI
Entity
Entity
▪ São modelos manipulados pelo Interactor
▪ Entity != Data Access Layer
▪Na maioria das vezes os modelos acabam
sendo PONSOs
Router
Router
▪ Responsável pela transação entre
diferentes módulos
▪ Responsável pela inicialização do próximo
módulo a ser chamado.
▪Responsável pela customização de
animações entre telas
Conclusão
▪ Maior facilidade em encontrar e resolver bugs
▪ Código mais "limpo" e compacto
▪ Gera uma maior reusabilidade do código
▪ Maior facilidade em adicionar/modificar features
▪ Fácil e rápido de escrever testes automatizados
confiáveis
Dúvidas?
https://br.linkedin.com/in/pedrohperalta
pedrohperalta
@pedrohperalta
Referências
http://clean-swift.com/single-responsibility-principle-
for-class/
https://www.objc.io/issues/13-architecture/viper/
https://www.ckl.io/blog/ios-project-architecture-
using-viper/

Mais conteúdo relacionado

PDF
iOS viper presentation
DOCX
Spammer detection and fake user Identification on Social Networks
PPS
Vb.net session 02
PPTX
簡単マルチプレイヤー@Ue4
PPTX
java-Unit4 chap2- awt controls and layout managers of applet
PDF
ドメイン駆動設計をゲーム開発に活かす
PPTX
React+TypeScriptと格闘して得た知見
PPTX
Bloc Pattern - Practical Use Cases - Flutter London - 21JAN2019
iOS viper presentation
Spammer detection and fake user Identification on Social Networks
Vb.net session 02
簡単マルチプレイヤー@Ue4
java-Unit4 chap2- awt controls and layout managers of applet
ドメイン駆動設計をゲーム開発に活かす
React+TypeScriptと格闘して得た知見
Bloc Pattern - Practical Use Cases - Flutter London - 21JAN2019

Mais procurados (20)

PDF
2020年8月_HoloLens 2 アプリ開発入門
PPTX
Observer Software Design Pattern
PPTX
VIPER Architecture
PDF
AWS와 Docker Swarm을 이용한 쉽고 빠른 컨테이너 오케스트레이션 - AWS Summit Seoul 2017
PDF
200人での対戦も可能!?Photon 新SDKについて
PPTX
Android Widget
PDF
Deep Dive async/await in Unity with UniTask(EN)
PPT
Developing an ASP.NET Web Application
PPTX
Voice based email for blinds
PPTX
Voice based email system for physically challenged
PPT
Visual Basic menu
PPTX
Java Constructors
PPTX
Top 11 Mobile App Development Frameworks
PPT
Spring Framework
PPTX
Proxy Design Pattern
PDF
遅延の少ないLivePreview方法
PDF
Observableで非同期処理
PPT
3D Technology
PPT
Mobile Application Development,J2ME,UNIT-4-JNTU
PDF
L23 Robotics and Drones
2020年8月_HoloLens 2 アプリ開発入門
Observer Software Design Pattern
VIPER Architecture
AWS와 Docker Swarm을 이용한 쉽고 빠른 컨테이너 오케스트레이션 - AWS Summit Seoul 2017
200人での対戦も可能!?Photon 新SDKについて
Android Widget
Deep Dive async/await in Unity with UniTask(EN)
Developing an ASP.NET Web Application
Voice based email for blinds
Voice based email system for physically challenged
Visual Basic menu
Java Constructors
Top 11 Mobile App Development Frameworks
Spring Framework
Proxy Design Pattern
遅延の少ないLivePreview方法
Observableで非同期処理
3D Technology
Mobile Application Development,J2ME,UNIT-4-JNTU
L23 Robotics and Drones
Anúncio

Destaque (20)

PDF
From mvc to viper
PDF
Rambler.iOS #5: VIPER и Swift
PPTX
Sexy Architecting. VIPER: MVP on steroids
PDF
Introduction to VIPER Architecture
PDF
Rambler.iOS #5: VIPER a la Rambler
PPTX
[SIP 2015] iOS Proposal: VIPER
PPTX
Viper - чистая архитектура iOS-приложения (И. Чирков)
PPTX
Software architectural design patterns(MVC, MVP, MVVM, VIPER) for iOS
PDF
안드로이드 개발자를 위한 스위프트
PDF
Break the monolith with (B)VIPER Modules
PPTX
iOS Viper architecture for CocoaHeadsBY (RU)
PDF
Infinum iOS Talks #2 - VIPER for everybody by Damjan Vujaklija
PDF
Rambler.iOS #5: Генерамба и прочие аспекты кодогенерации в VIPER
PDF
Clean architecture workshop
PPTX
iOS Architecture
PDF
PDF
«ReactiveCocoa и MVVM» — Николай Касьянов, SoftWear
PDF
EMC SCALEIO
PDF
An (highly elementary) introduction to VIPER
PPTX
ReactiveCocoa: делаем отзывчивое приложение (П. Руденко)
From mvc to viper
Rambler.iOS #5: VIPER и Swift
Sexy Architecting. VIPER: MVP on steroids
Introduction to VIPER Architecture
Rambler.iOS #5: VIPER a la Rambler
[SIP 2015] iOS Proposal: VIPER
Viper - чистая архитектура iOS-приложения (И. Чирков)
Software architectural design patterns(MVC, MVP, MVVM, VIPER) for iOS
안드로이드 개발자를 위한 스위프트
Break the monolith with (B)VIPER Modules
iOS Viper architecture for CocoaHeadsBY (RU)
Infinum iOS Talks #2 - VIPER for everybody by Damjan Vujaklija
Rambler.iOS #5: Генерамба и прочие аспекты кодогенерации в VIPER
Clean architecture workshop
iOS Architecture
«ReactiveCocoa и MVVM» — Николай Касьянов, SoftWear
EMC SCALEIO
An (highly elementary) introduction to VIPER
ReactiveCocoa: делаем отзывчивое приложение (П. Руденко)
Anúncio

Semelhante a VIPER - Design Pattern (20)

PDF
Pilares do desenvolvimento Mobile no Nubank
PPTX
Estudos Technocorp
ODP
Design Patterns
PDF
Como escrever apps de qualidade em qualquer arquitetura
PDF
Design patterns
KEY
Desenvolvimento iOS - Aula 2
PDF
Quick reference
PDF
Clean Architecture
PPTX
5507 os principais design patterns
PDF
Programação Orientada a Objetos - Pós Graduação - Aula 8 - Bad Smells & Desig...
PPT
OOP ObjC
PDF
O que você precisa para iniciar no iOS e Objective-C -
PPTX
IMaster Developer Week RJ - Qualidade de software: SOLID/DDD
PDF
Design patterns: resolvendo problemas comuns (ruby)
PDF
Design Pattern MVC – Arquitetura de Software Coesa e Flexível
PDF
Padrões-05 - Padrões Arquiteturais - MVC
PPTX
Padrões de projeto
PPTX
Clean architecture
PDF
Padrões de projetos
PDF
Desenvolvimento Moderno de aplicativos Android
Pilares do desenvolvimento Mobile no Nubank
Estudos Technocorp
Design Patterns
Como escrever apps de qualidade em qualquer arquitetura
Design patterns
Desenvolvimento iOS - Aula 2
Quick reference
Clean Architecture
5507 os principais design patterns
Programação Orientada a Objetos - Pós Graduação - Aula 8 - Bad Smells & Desig...
OOP ObjC
O que você precisa para iniciar no iOS e Objective-C -
IMaster Developer Week RJ - Qualidade de software: SOLID/DDD
Design patterns: resolvendo problemas comuns (ruby)
Design Pattern MVC – Arquitetura de Software Coesa e Flexível
Padrões-05 - Padrões Arquiteturais - MVC
Padrões de projeto
Clean architecture
Padrões de projetos
Desenvolvimento Moderno de aplicativos Android

Último (19)

PPTX
Programação - Linguagem C - Variáveis, Palavras Reservadas, tipos de dados, c...
PDF
20250805_ServiceNow e a Arquitetura Orientada a Serviços (SOA) A Base para Ap...
PPTX
Gestao-de-Bugs-em-Software-Introducao.pptxxxxxxxx
PPTX
Aula 18 - Manipulacao De Arquivos python
PDF
Fullfilment AI - Forum ecommerce 2025 // Distrito e Total Express
PPTX
Como-se-implementa-um-softwareeeeeeeeeeeeeeeeeeeeeeeee.pptx
PDF
Mergulho profundo técnico para gestão de transportes no SAP S/4HANA, S4TM6 Col14
PPTX
Informática Aplicada Informática Aplicada Plano de Ensino - estudo de caso NR...
PDF
Processos na gestão de transportes, TM100 Col18
PPTX
BANCO DE DADOS - AULAS INICIAIS-sgbd.pptx
PDF
Otimizador de planejamento e execução no SAP Transportation Management, TM120...
PPTX
Aula16ManipulaçãoDadosssssssssssssssssssssssssssss
PDF
COBITxITIL-Entenda as diferença em uso governança TI
PDF
Aula04-Academia Heri- Tecnologia Geral 2025
PDF
Apple Pippin Uma breve introdução. - David Glotz
PDF
Custos e liquidação no SAP Transportation Management, TM130 Col18
PDF
Custos e faturamento no SAP S/4HANA Transportation Management, S4TM3 Col26
PDF
Gestão de transportes básica no SAP S/4HANA, S4611 Col20
PDF
Fundamentos de gerenciamento de ordens e planejamento no SAP TransportationMa...
Programação - Linguagem C - Variáveis, Palavras Reservadas, tipos de dados, c...
20250805_ServiceNow e a Arquitetura Orientada a Serviços (SOA) A Base para Ap...
Gestao-de-Bugs-em-Software-Introducao.pptxxxxxxxx
Aula 18 - Manipulacao De Arquivos python
Fullfilment AI - Forum ecommerce 2025 // Distrito e Total Express
Como-se-implementa-um-softwareeeeeeeeeeeeeeeeeeeeeeeee.pptx
Mergulho profundo técnico para gestão de transportes no SAP S/4HANA, S4TM6 Col14
Informática Aplicada Informática Aplicada Plano de Ensino - estudo de caso NR...
Processos na gestão de transportes, TM100 Col18
BANCO DE DADOS - AULAS INICIAIS-sgbd.pptx
Otimizador de planejamento e execução no SAP Transportation Management, TM120...
Aula16ManipulaçãoDadosssssssssssssssssssssssssssss
COBITxITIL-Entenda as diferença em uso governança TI
Aula04-Academia Heri- Tecnologia Geral 2025
Apple Pippin Uma breve introdução. - David Glotz
Custos e liquidação no SAP Transportation Management, TM130 Col18
Custos e faturamento no SAP S/4HANA Transportation Management, S4TM3 Col26
Gestão de transportes básica no SAP S/4HANA, S4611 Col20
Fundamentos de gerenciamento de ordens e planejamento no SAP TransportationMa...

VIPER - Design Pattern