ReactorKit + Unit Test

Related tags

Miscellaneous left7
Overview

left7

현재 세계에서 상영중인 목록을 보여주는 ReactorKit + CleanArchitecture를 도입한 개인 프로젝트입니다.

gif

Directory Tree

├── Left7
│   ├── Application
│   ├── Utility
│   ├── Presentation
│   │   ├── Home
│   │   │   ├── View
│   │   │   │   └── Cell
│   │   │   │       ├── View
│   │   │   │       └── Reactor
│   │   │   └── Reactor
│   │   ├── Detail
│   │   │   ├── View
│   │   │   └── Reactor
│   │   ├── Favorite
│   │   │   └── View
│   │   │       ├── Cell
│   │   │       │   ├── View
│   │   │       │   └── Reactor
│   │   │       └── Reactor
│   │   ├── Common
│   │   └── Extension
│   ├── Domain
│   │   ├── Entity
│   │   ├── Interface
│   │   └── UseCase
│   │       └── Protocol
│   ├── Data
│   │   ├── ResponseModel
│   │   │   ├── CoreData
│   │   │   └── Network
│   │   ├── Network
│   │   │   ├── Protocol
│   │   │   ├── Support
│   │   │   └── Error
│   │   ├── CoreData
│   │   │   └── Error
│   │   └── Repository
│   └── Resource
└── Left7Test
    ├── Common
    ├── HomeView
    │   └── Cell
    ├── DeatilView
    ├── FavoriteView
    │   └── Cell
    ├── Repository
    ├── Network
    │   └── Support
    ├── TestDouble
    │   ├── Stub
    │   │   ├── Network
    │   │   └── UseCase
    │   └── Mock
    │       ├── Repository
    │       └── Network
    └── Extension

기술 스택

  • UIKit
  • CoreData
  • SPM
  • UnitTest

Architecture

ReactorKit + CleanArchitecture

image

ReactorKit

View는 Action만 Reactor로 보내고 Reactor에 비즈니스 로직이 위치해 로직을 적용한 State를 반환하므로 완전히 분리되어 로직만을 가진 Reactor는 테스트하기 용이하다라고 생각하여 적용하였고, 모든 Reactor를 테스트하였습니다.

하지만 이는 MVVM에서도 가능한 이야기이지만, 제가 생각하는 ReactorKit 대표적인 장점은 View에서 Reactor에게 Action을 전달하고 Reactor의 State와 UI컴포넌트를 바인딩만 해두면 되어서 View의 비즈니스 로직이 거의 존재하지 않게 되고, View에서 Action을 보내면 그에 해당하는 Mutation이 정해져있고, Reduce를 통해 기존 State가 바뀌는 형태로 흐름을 추적하기 쉽다고 생각하여 채택하였습니다.

또한 템플릿화 되어 많은 사람들이 비슷한 형태로 구현한다는 점에서 코드 또한 이해하기 쉽다고 생각하였습니다.

CleanArchitecture

MVVM에서의 ViewModel이 ReactorKit의 Reactor와 같은 역할을 하기 때문에 비슷하다 라고 생각하였고, 많이들 이용하는 MVVM+CleanArchitecture 또한 ReactorKit+CleanArchitecture로 사용할 수 있지 않을까란 이유로 CleanArchitecture를 적용하였습니다.

역할 분리가 명확하고 기능을 추가하거나 개선할 때 특정 레이어만 접근하기 때문에 확장성과 개발 편의성이 좋다고 생각합니다. 또한 역할 분리가 명확히 나뉘어 있기 때문에 테스트와 코드를 파악하는데 이점이 있다고 생각하였고, 레이어의 요소를 추상화하여(UseCase, Repository, Service)테스트를 진행하였습니다.

라이브러리

  • RxSwift
  • RxCocoa
  • ReactorKit
  • KingFisher
  • SnapKit

Coverage

image

You might also like...
I built this application with unit testing and test-driven development to understand TDD theory and practice
I built this application with unit testing and test-driven development to understand TDD theory and practice

TestDrivenDevelopment Description I built this application with unit testing and test-driven development to understand TDD theory and practice, to wri

Project shows how to unit test asynchronous API calls in Swift using Mocking without using any 3rd party software

UnitTestingNetworkCalls-Swift Project shows how to unit test asynchronous API ca

Testable Combine Publishers - An easy, declarative way to unit test Combine Publishers in Swift
Testable Combine Publishers - An easy, declarative way to unit test Combine Publishers in Swift

Testable Combine Publishers An easy, declarative way to unit test Combine Publishers in Swift About Combine Publishers are notoriously verbose to unit

iOS architectures - MVC, MVP, MVVM, MVVM-C, ReactorKit, VIPER, Clean Architecture
iOS architectures - MVC, MVP, MVVM, MVVM-C, ReactorKit, VIPER, Clean Architecture

iOS architectures - MVC, MVP, MVVM, MVVM-C, ReactorKit, VIPER, Clean Architecture, RIBs; Repository Pattern, Rxflow, Swinject, Tuist, Xcodegen, Cocoapods, SPM, Carthage + Rome

iOS Todo Application using RxSwift and ReactorKit
iOS Todo Application using RxSwift and ReactorKit

RxTodo RxTodo is an iOS application developed using ReactorKit. This project is for whom having trouble with learning how to build a RxSwift applicati

Dribbble for iOS using ReactorKit
Dribbble for iOS using ReactorKit

Drrrible Unofficial Dribbble iOS application using ReactorKit. IMPORTANT NOTICE Since Dribbble has deprecated public APIs, this app will not work anym

ReactorKit karrotFlex example
ReactorKit karrotFlex example

reactorKit-karrotFlex-example 🎉 ReactorKit + KarrotFlex 예제 작성을 위해서 만들어진 프로젝트로 r

GitTime is GitHub Tracking App. Using ReactorKit, RxSwift, Moya.
GitTime is GitHub Tracking App. Using ReactorKit, RxSwift, Moya.

GitTime Feature Activity: GitHub Contributions graph & Event lists Trending: Trending Repositories & Developers Buddys: Show your buddy's contribution

Test-To-Do-List - Test To Do List with core data
Test-To-Do-List - Test To Do List with core data

test-To-Do-List This is my first pet project with core data Launch screen Main s

Kfm-ios-test - Test online for iOS Developer position in Kimia Farma or PT. Buana Varia Komputama
Kfm-ios-test - Test online for iOS Developer position in Kimia Farma or PT. Buana Varia Komputama

kfm-ios-test Kimia Farma Mobile iOS Test Test online for iOS Developer position

Mockit is a Tasty mocking framework for unit tests in Swift 5.0
Mockit is a Tasty mocking framework for unit tests in Swift 5.0

Mockit Introduction Mockit is a Tasty mocking framework for unit tests in Swift 5.0. It's at an early stage of development, but its current features a

SwiftUI sample app using Clean Architecture. Examples of working with CoreData persistence, networking, dependency injection, unit testing, and more.
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

SwiftUI sample app using Clean Architecture. Examples of working with CoreData persistence, networking, dependency injection, unit testing, and more.
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

Find common xib and storyboard-related problems without running your app or writing unit tests.
Find common xib and storyboard-related problems without running your app or writing unit tests.

IBAnalyzer Find common xib and storyboard-related problems without running your app or writing unit tests. Usage Pass a path to your project to ibanal

Runtime introspection and unit testing of SwiftUI views

ViewInspector is a library for unit testing SwiftUI views. It allows for traversing a view hierarchy at runtime providing direct access to the underlying View structs.

Trying to implement Unit Tests for @Binding properties in a ViewModel

BindingTester Trying to implement Unit Tests for @Binding properties in a ViewModel ViewModel to be tested class SheetViewModel: ObservableObject {

Library for unifying the approach to network mocking in iOS unit- & UI-tests.

TinkoffMockStrapping Example To run the example project, clone the repo, and run pod install from the Example directory first. Requirements Installati

Advanced Networking Layer Using Alamofire with Unit Testing

Advanced Networking Layer Using Alamofire with Unit Testing

This is BouncyBall, from Develop in Swift Explorations Unit 3, completed into Part 3, where the onTapped function gets a little squirrelly

This is BouncyBall, from Develop in Swift Explorations Unit 3, completed into Part 3, where the onTapped function gets a little squirrelly. Use this version when you add a function to be called when the funnel is tapped and taps aren't registered in the simulator.

Owner
LIMJISEONG
LIMJISEONG
iOS architectures - MVC, MVP, MVVM, MVVM-C, ReactorKit, VIPER, Clean Architecture

iOS architectures - MVC, MVP, MVVM, MVVM-C, ReactorKit, VIPER, Clean Architecture, RIBs; Repository Pattern, Rxflow, Swinject, Tuist, Xcodegen, Cocoapods, SPM, Carthage + Rome

null 123 Dec 21, 2022
This is BouncyBall, from Develop in Swift Explorations Unit 3, completed into Part 3, where the onTapped function gets a little squirrelly

This is BouncyBall, from Develop in Swift Explorations Unit 3, completed into Part 3, where the onTapped function gets a little squirrelly. Use this version when you add a function to be called when the funnel is tapped and taps aren't registered in the simulator.

Teaching Develop in Swift 0 Nov 20, 2021
RetroVisor helps you with inspecting UIViews in your unit tests.

RetroVisor RetroVisor helps you with inspecting UIViews in your unit tests. You do test views in unit tests, right? Right? Usually, I mark subview pro

Vid Tadel 2 Mar 29, 2022
Coreml-performance project works on MacOS to test M1 macbooks

ml-macos-performance This project is inspired by Vladimir Chernykh coreml-performance project for iOS. I made changes so it works on MacOS to test M1

Peter Lin 0 Nov 28, 2021
Test application that gets its data from the themoviedb api

SWorld app Aplicacion de prueba que obtiene sus datos de la api themoviedb, se permite listar, buscar por titulos y acceder al detalle Prerquisitos pa

null 0 Nov 17, 2021
tuist, BDD - Test Code, CleanArchitecture, ReactorKit, Swinject

SwinjectReactorKitExample This is a Demo App for tuist, Swinject, Clean Architectue, ReactorKit and BDD 이 프로젝트를 실행시켜보려면 tuist를 깔고, generate해야함 실행해도 별거

Havi 21 Nov 14, 2022
Unit-Converter-SwiftUI - A simple Unit Converter iOS app built in the process of learning SwiftUI

SwiftUI-Unit-Converter A simple Unit Converter iOS app built in the process of l

Ishaan Bedi 2 Jul 13, 2022
The XCTest Project, A Swift core library for providing unit test support

XCTest The XCTest library is designed to provide a common framework for writing unit tests in Swift, for Swift packages and applications. This version

Apple 1k Jan 4, 2023
Write unit tests which test the layout of a view in multiple configurations

Overview This library enables you to write unit tests which test the layout of a view in multiple configurations. It tests the view with different dat

LinkedIn 565 Nov 16, 2022
XCTestExtensions is a Swift extension that provides convenient assertions for writing Unit Test.

XCTestExtensions Features XCTAssertEventually (that convenient assertions for writing Unit Test). Use "XCTAssertEventually", you can write asynchronou

shindyu 22 Dec 1, 2022