Coder Social home page Coder Social logo

kudoleh / ios-clean-architecture-mvvm Goto Github PK

View Code? Open in Web Editor NEW
3.7K 59.0 645.0 2.48 MB

Template iOS app using Clean Architecture and MVVM. Includes DIContainer, FlowCoordinator, DTO, Response Caching and one of the views in SwiftUI

Home Page: https://tech.olx.com/clean-architecture-and-mvvm-on-ios-c9d167d9f5b3

Swift 99.94% Ruby 0.06%
clean-architecture ios-swift swiftui mvvm-ios mvvm-architecture viewmodel mvvm xcode architecture viewmodels

ios-clean-architecture-mvvm's Introduction

Template iOS App using Clean Architecture and MVVM

iOS Project implemented with Clean Layered Architecture and MVVM. (Can be used as Template project by replacing item name “Movie”). More information in medium post: Medium Post about Clean Architecture + MVVM

Alt text

Layers

  • Domain Layer = Entities + Use Cases + Repositories Interfaces
  • Data Repositories Layer = Repositories Implementations + API (Network) + Persistence DB
  • Presentation Layer (MVVM) = ViewModels + Views

Dependency Direction

Alt text

Note: Domain Layer should not include anything from other layers(e.g Presentation — UIKit or SwiftUI or Data Layer — Mapping Codable)

Architecture concepts used here

Includes

  • Pagination
  • Unit Tests for Use Cases(Domain Layer), ViewModels(Presentation Layer), NetworkService(Infrastructure Layer)
  • Dark Mode
  • Size Classes and UIStackView in Detail view
  • SwiftUI example, demostration that presentation layer does not change, only UI (at least Xcode 11 required)

Networking

If you would like to reuse Networking from this example project as repository I made it availabe here

Views in Code vs Storyboard

This repository uses Storyboards (except one view written in SwiftUI). There is another similar repository but instead of using Storyboards, all Views are written in Code. It also uses UITableViewDiffableDataSource: iOS-Clean-Architecture-MVVM-Views-In-Code

How to use app

To search a movie, write a name of a movie inside searchbar and hit search button. There are two network calls: request movies and request poster images. Every successful search query is stored persistently.

Demo.mp4

Requirements

  • Xcode Version 11.2.1+ Swift 5.0+

ios-clean-architecture-mvvm's People

Contributors

cozytk avatar dependabot[bot] avatar gaeng2y avatar headonn5 avatar ictechgy avatar ioramashvili avatar jeon0976 avatar kim-junhwan avatar kudoleh avatar lengocgiang avatar michael-martinez avatar proalexusc avatar sxxjxxhxxn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ios-clean-architecture-mvvm's Issues

[Question] `Data` package depends on `Networking` package?

First of all, thank you for your brilliant work publishing your article and the example source code.

I have a question regarding the diagram in your article, according to your diagram, the dependency direction should be from the "Networking" package to "Data" package
image

However in your example code, Data is depending on Networking, is this a violation of dependency direction?
image

MoviesListViewController has Repository

Hi,

  • I was wondering why the PosterImageRepository directly accesses the MoviesListViewController without going through a UseCase=(Domain). I'm confused by this part.
  • I guess that it is because the fetchImage response type is a Data, so there is no need to go through the Domain, am i right?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.