MVP-Clean sample iOS Swift project

Overview

RestaurantsApp

MVP-Clean sample iOS Swift project

The purpose of this document is to explain the architecture of application.

This application shows restaurants nearby to user's current location. It has features to show those restaurants locations in list with pagination and also in map. Also, on tap of list row or map annotation, restaurant details are shown. User can start map navigation to restaurant from details screen.

Below are running app screenshots:

list map

details navigation error pagination

Table of Contents

  1. Architecture
  2. Implementation
  3. Testing
  4. Project Setup
  5. Notes
  6. Pending Improvements (// TODOs)

1. Architecture

The project is divided into different folder which act as logical units. Each unit has its own responsibility and behaviour. All components communication is done using abstraction. This app divided into below folder structure:

folders

This diagram will illustrate high level implementation of architecture(3 + 1 architecture) architecture

Presentation:

Responsible to handle all user events on view. It consist below things:

Presenter: It is responsible to update the result of business logic to viewController. this update is handled using viewState binding.

ViewController: It links the user controls to update them when needed. View will inform presenter about user action.

Domain:

Handler of all business logic and models. It consist below things:

Models: Models are Entities domain model representation.

UseCases: It is responsible to handle use case and business logic. Protocols and their implementations to represent business logics

ProviderProtocols: These are Protocol which can be confirmed in data layer.

Data:

Responsible to retrieve all the data required by the application. It consist below things:

Entities: It defines structs for responses representation.

Services: Service layer is for getting the data through data source, in this case it is network.

Providers: It handle sthe services and retrieve the data from services and updates domain model about the data.

App:

Responsible to manage app level responibilities. It consist below things:

Routers: It defines and implements all the navigation logic.

Builder: Builders is used for injecting dependencies across modules.

2. Implementation

To develop this, MVP-CLEAN architecture is used.

3. Testing

  • Under PresentationTests, there are unit test cases for Presenters.
  • Under DomainTests, there are unit test cases for Models and UseCases.
  • Under DataTests, there are unit test cases for Repositories.

4. Project Setup

To run this project on a local machine follow below steps:

  • Inside /Restaurants/Restaurants/Data/Services/NetworkServiceConstants.swift, assign valid Google API key with places API enabled to constant apiKey
  • Open Restaurants.xcodeproj file in Xcode 13.x version and run it on the simulator.
  • For simulator, simulate desired location.

5. Notes

  • RestarantsParent to List and Map communication is done through Router. To achieve this childViews are added through Router to enable presenter-presenter communication. There are other simple ways availble like parent-child View-View communication but it forces us to pass domain models from parent view to child view.

6. Pending Improvements (// TODOs)

  • Improve async image loading in RestaurantTableViewCell. Add implementation to handle cancellation of image downloading.
  • Improve overall test code coverage.
  • Decouple presenters from LocationManager
  • Create dynamic frameworks for each layer.
  • Create Xcode templates to repeat this code structure easily.
You might also like...
Приложение является реализацией модуля новостной ленты VK. Архитектура Clean Swift.
Приложение является реализацией модуля новостной ленты VK. Архитектура Clean Swift.

Новостная лента VK Приложение является реализацией модуля новостной ленты VK. Особенности приложения архитектура Clean Swift; программная реализация и

App for displaying VK news feed (VKSDK API). Clean Swift VIP architecture
App for displaying VK news feed (VKSDK API). Clean Swift VIP architecture

VKNewsFeed VKNewsFeed - application for displaying VK news feed with dynamic cells and a collection of images in the post. Data request occurs from th

Dogs - A fun exploration of using Clean Swift methodology (VIP) to build a simple app
Dogs - A fun exploration of using Clean Swift methodology (VIP) to build a simple app

Dogs A fun exploration of using Clean Swift methodology (VIP) to build a simple app Was following the directory structure and templates as described i

Github repo search with using mvvm-c and clean architecture and using combine swift

GitSearchWithMVVM-C-CleanArchitecture Github repo search with using mvvm-c and clean architecture and using combine swift. Content Overview How To Run

A simple clean application to provide you with weather forecast data as well as currency rates, all with beautiful melodies and sounds
A simple clean application to provide you with weather forecast data as well as currency rates, all with beautiful melodies and sounds

A simple clean application to provide you with weather forecast data as well as currency rates, all with beautiful melodies and sounds.

Hello Clean Architecture With SwiftUI
Hello Clean Architecture With SwiftUI

HelloCleanArchitectureWithSwiftUI CleanArchitecture for SwiftUI with Combine, Co

A Flutter Clean Architecture Using GetX.
A Flutter Clean Architecture Using GetX.

flutter-getx-clean-architecture A Flutter Clean Architecture Using GetX. Work Flow Project Structure |-- lib |-- main.dart |-- app |--

Don't start from scratch, start from Here! This is a starter project for iOS projects. It contains all the basic configurations and common libraries for your project.

Starter-iOS Don't start from scratch, start from Here! This is a starter project for iOS projects. It contains all the basic configurations and common

NewsAPI-Project - News API Project For iOS
NewsAPI-Project - News API Project For iOS

NewsAPI-Project Es necesario descargar y realizar un pod install para ejecutar e

Owner
Atul Ghorpade
iOS Developer
Atul Ghorpade
Sample iOS project built by SwiftUI + Flux and Combine framework using GitHub API

SwiftUI-Flux Flux enables us to have unidirectional data flow and make it testable. It's used to be implemented using RxSwift or ReactiveSwift in the

Yusuke Kita 87 Nov 25, 2022
Sample iOS project built by SwiftUI + MVVM and Combine framework using GitHub API

SwiftUI-MVVM One of the biggest idea for having MVVM is that most of data flow can be testable. Data binding in view layer by SwiftUI is awesome. Howe

Yusuke Kita 592 Jan 2, 2023
A sample project how to use YOLOv5 in iOS

CoreML-YOLOv5 A sample project how to use YOLOv5 in iOS. You can run model on yo

MLBoy 32 Dec 19, 2022
SwiftUI-MSALSample - Sample project to login with MSAL using SwiftUI

SwiftUI-MSALSample I could not find a good walkthrough on how to implement MSAL

Rob Evans 10 Nov 7, 2022
An iOS application written in Swift to demonstrate how to implement a Clean Architecture in iOS

Reminders iOS An iOS application written in Swift to demonstrate how to implement a Clean Architecture in iOS. Idea The idea is to implement the simpl

Tiago Martinho 306 Nov 9, 2022
Mahmoud-Abdelwahab 5 Nov 23, 2022
RippleQueries is an iOS application built as assessment task at Ripple Egypt. Built Using MVVM (Model-View-ViewModel) and Clean Architecture concepts

RippleRepositories RippleRepositories is an iOS application built as an assessment task at Ripple Egypt. Built Using RxSwift & MVVM (Model-View-ViewMo

Muhammad Ewaily 3 Sep 16, 2021
Assignment: iOS app in VIP Clean architecture

countries_vip_clean Assignment: iOS app in VIP Clean architecture. for countries

Vishwa Deepak Choudhary 1 Feb 7, 2022
A simple to use iOS app with clean UI to calculate time until a specified date

A simple to use iOS app with clean UI to calculate time until a specified date.Added new feature that is now you can measure time from a specified date as well. Like time spent from the day you were born.

Dishant Nagpal 2 Feb 28, 2022
Weather Forecast App (OpenWeather API & CLLocationManager). Clean Swift VIP architecture.

WeatherApp Weather Forecast App (OpenWeather API & CLLocationManager). Clean Swift VIP architecture. Without storyboard or xib. The application shows

Nikita Lomovtsev 7 Dec 25, 2022