Skip to content

blink22/code-sample-ios

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

iOS VIPER Architecture: Sample App

This repository contains a detailed sample app that implements VIPER architecture using



Architecture


In order to perform its mission module, it is necessary to solve several problems. It is required to implement the business logic module, networking, database, render the user interface. VIPER describes the role of each component and how they interact with each other.

Viper Components

1. View

The View layer is responsible for displaying the user interface and capturing user input. It should not contain business logic. Instead, it delegates user actions to the Presenter for processing.

2. Interactor

The Interactor layer contains the business logic and is responsible for interacting with the data layer. It receives requests from the Presenter, processes them, and returns the results.

3. Presenter

The Presenter acts as a mediator between the View and the Interactor. It receives user input from the View, processes it, and updates the View accordingly. The Presenter also communicates with the Interactor to fetch or manipulate data.

4. Entity

The Entity layer represents the data models used in the application. It encapsulates the data and business logic related to the application's domain.

5. Router

The Router handles navigation and routing logic. It is responsible for transitioning between different screens or modules within the application.

Viper General Rules

1. Module Naming

  • Modules should be named according to functionality.
    • Example: LoginView, UserProfileInteractor.

2. Dependency Injection

  • Inject dependencies during initialization.
    • Avoid components creating their own dependencies.

3. Single Responsibility Principle

  • Each component should have a single responsibility.
    • Keep components focused on specific tasks.

4. Protocol Usage

  • Use protocols to define interfaces.
    • Promotes loose coupling and easy testing.

Structure

Requirements

  • iOS 15.0+
  • Xcode 13
  • Swift 5

How to use

git clone https://github.com/blink22/Code-Sample-iOS.git
cd Code-Sample-iOS
pod install
open Code-Sample-iOS.xcworkspace

Read the below listed articles. They describe the VIPER concepts.

  1. Straight to the point: VIPER architectural pattern
  2. VIPER Architecture for iOS App Development
  3. Understanding and implementing VIPER architecture for iOS applications

General Notes

  • Make sure to test your code (Don't depend on having a QA or PR reviewers to find the bugs)
  • DON'T make any changes on production before communicating with your manager/senior

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •