Skip to content

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

Notifications You must be signed in to change notification settings

yeahsilver/iOS-Clean-Architecture-MVVM

 
 

Repository files navigation

[🇰🇷 Korean ver.] Clean Architecture와 MVVM를 사용한 iOS 앱 템플릿

해당 iOS 프로젝트는 Clean Layered Architecture와 MVVM 방식으로 구현되어있다. ("Movie"라는 아이템 이름으로 해당 템플릿이 사용되었다.) 자세한 정보는 중간 포스트에서 확인해볼 수 있다: Medium Post about Clean Architecture + MVVM.

Alt text

계층

  • 도메인 계층 = 개체 (Entities) + 유스케이스 (Use Cases) + 레포지토리 인터페이스 부분 (Repositories Interfaces)
  • 데이터 레포지토리 계층: 레포지토리 구현 부분 (Repositories Implementations) + API (네트워크) + 지속되는 DB
  • 프레젠테이션 계층(MVVM): 뷰 모델 (View Models) + 뷰 (Views)

의존 방향

Alt text

주의: 도메인 계층은 다른 계층의 요소들을 포함할 수 없다. (예시: Presentation - UIKit or SwiftUI or 데이터 계층 - Codable로 매핑)

여기에서 사용되는 아키텍처 개념

포함 요소

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

네트워킹

만약 레포지토리에 있는 해당 예시에서 네트워킹을 사용하고 싶다면, 바로가기 를 참고하면 된다.

필수 요소

  • Xcode 11.2.1버전 이상, swift 5.0 버전 이상

사용 원리

영화를 찾기 위해선 서치바에 이름을 적고 찾기 버튼을 누른다.

여기서는 영화 요청과 poster image 요청의 두개의 네트워크가 호출된다. 성공된 모든 검색 쿼리는 영구적으로 보존된다.

About

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

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Swift 99.9%
  • Ruby 0.1%