This is an example of clean architecture and MVVM pattern written in swift

Overview

Swift Clean Architecture MVVM

This is an example of clean architecture and MVVM pattern written in swift

First of all thanks to all of those who made our lives easier Thanks to uncle bob for the clean architecture

Thanks to Mocky[https://designer.mocky.io] for creating the mocking APIs

Generics

I've tried to use generics to make every things follows the same patterns.

The base view controller will contain a view model that will be a generic based on the base view model

The base view model will have a usecase which is the parent use case for all usecases in the project

The networking class have only one method that will call our API using #Alamofire and for parsing it will take a generic model that is Codable

The Domain layer

Contains all the use cases, Entities and the defintion of our repository for the project we have a single use that will represent one task that should be done we also have usecase which group all the usecases that is related to one feature

within the single use cases, I have intended to convert the completion handler to combine, this is only to show the two ways of dealing with our requests although we can stick to combine within the networking layer or stick to completion handler

The Data layer

Contains the data sources that implement the protocl of data source for now there is only remote data source that will fetch the content from the API, but when creating the local data source we should implement the protocol of the data source.

we also have the repository implementation within this layer that will be responsible of declaring the implementation from the domain layer and for sure will be responsible of fetching the data and handling the data from local/remote sources

The difference between the model in this layer and the entity in the domain layer is that the model here will be used to parse the json Object from the API, whereas the entity in the domain will be used to communicate with the presentation layer as it will be easier after converting the model to entity

The Presentation layer

Contains all the views, storyboards, custom views, custom cells and the view controllers each view model will be a child for BaseViewModel, and each view controller will be a child for BaseViewController where we should declare the viewmodel that will be used

To DO:

  • Enhance the API class to inculde all the cases
  • Add more tests
  • Replace Completion handler with Combine and keep the refrence for completion handle
  • Add Swift UI examples
You might also like...
Sample project using VIPER architecture

VIPER-Persons Small project using a master and detail view Demonstrates the use of the following features: VIPER architecture (https://mutualmobile.co

Challenge-viper-finance - Project for VIPER Architecture Dev Sprints on Devpass
Challenge-viper-finance - Project for VIPER Architecture Dev Sprints on Devpass

VIPER Challenge - Finance App 💰 Neste desafio, aplicaremos conceitos da arquite

Sample applications of iOS Design patterns written using swift.

ios-design-patterns This repo contains all my Sample applications of iOS Design patterns written using swift. Link for my Design patterns Blog : https

Techcareer.net Bootcamp graduation project written with VIPER, highly inspired by Getir
Techcareer.net Bootcamp graduation project written with VIPER, highly inspired by Getir

götür Techcareer.net iOS Bootcamp'i bitirme projesi, Getir'den yüksek miktarda i

Spin aims to provide a versatile Feedback Loop implementation working with the three main reactive frameworks available in the Swift community (RxSwift, ReactiveSwift and Combine)
Spin aims to provide a versatile Feedback Loop implementation working with the three main reactive frameworks available in the Swift community (RxSwift, ReactiveSwift and Combine)

With the introduction of Combine and SwiftUI, we will face some transition periods in our code base. Our applications will use both Combine and a thir

A Swift 4.2 VIPER Module Boilerplate Generator with predefined functions and a BaseViewProtocol.
A Swift 4.2 VIPER Module Boilerplate Generator with predefined functions and a BaseViewProtocol.

Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away. Are you new to VIPER Design Pattern? Want

Stateful view controller containment for iOS and tvOS
Stateful view controller containment for iOS and tvOS

StateViewController When creating rich view controllers, a single view controller class is often tasked with managing the appearance of many other vie

📖 Design Patterns implemented in Swift 5.0

Design Patterns implemented in Swift 5.0 A short cheat-sheet with Xcode 10.2 Playground (Design-Patterns.playground.zip). 🇨🇳 中文版 👷 Project started

Viper Framework for iOS using Swift
Viper Framework for iOS using Swift

Write an iOS app following VIPER architecture. But in an easy way. Viper the easy way We all know Viper is cool. But we also know that it's hard to se

Owner
null
SwiftUI sample app using Clean Architecture. Examples of working with CoreData persistence, networking, dependency injection, unit testing, and more.

Articles related to this project Clean Architecture for SwiftUI Programmatic navigation in SwiftUI project Separation of Concerns in Software Design C

Alexey Naumov 4k Dec 31, 2022
Clean Actor Model Architecture

CAMA Eonil, 2021. CAMA is short for "Clean Actor Model Architecture". As like it says, its CA(Clean Architecture) + AM(Actor model). AM here means AM

Eonil 1 Oct 10, 2021
A collection of iOS architectures - MVC, MVVM, MVVM+RxSwift, VIPER, RIBs and many others

ios-architecture WIP ?? ?? ?? ??️ Demystifying MVC, MVVM, VIPER, RIBs and many others A collection of simple one screen apps to showcase and discuss d

Pawel Krawiec 1.3k Jan 3, 2023
MoneySafe - Application for tracking income and expenses and analyzing expenses. VIPER architecture, CoreData, Charts

?? MoneySafe ?? Application for tracking income and expenses and analyzing expen

Vladislav 5 Dec 27, 2022
A holistic approach to iOS development, inspired by Redux and MVVM

Tempura is a holistic approach to iOS development, it borrows concepts from Redux (through Katana) and MVVM. ?? Installation Requirements CocoaPods Sw

Bending Spoons 693 Jan 4, 2023
This repository contains a detailed sample app that implements VIPER architecture in iOS using libraries and frameworks like Alamofire, AlamofireImage, PKHUD, CoreData etc.

iOS Viper Architecture: Sample App This repository contains a detailed sample app that implements VIPER architecture using libraries and frameworks li

MindOrks 653 Jan 2, 2023
Swift Interaction with VIPER Architecture

SwiftyVIPER SwiftyVIPER allows easy use of VIPER architecture throughout your iOS application. VIPER Architecture What is VIPER? Great question! VIPER

Cody Winton 121 Jan 2, 2023
Sample Code of the App Architecture Book

App Architecture iOS Application Design Patterns in Swift Welcome to the repository of the App Architecture book! This repository hosts all sample cod

objc.io 2k Dec 29, 2022
Reactant is a reactive architecture for iOS

Reactant Reactant is a foundation for rapid and safe iOS development. It allows you to cut down your development costs by improving reusability, testa

Brightify 374 Nov 22, 2022
YARCH iOS Architecture

YARCH is an architecture pattern developed primarly for iOS applications. You can ask any questions in our telegram channel. Russian version of the re

Alfa Digital 196 Jan 3, 2023