์ผ | ์ | ํ | ์ | ๋ชฉ | ๊ธ | ํ |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 |
- XCTest
- TCA
- raywenderlich
- Swfit
- designpattern
- reactorkit
- Xcode
- ํ๋ก๊ทธ๋๋จธ์ค
- SnapKit
- visionOS
- RxSwift
- SwiftUI
- swift
- ๋ฐฑ์ค
- tableView
- node.js
- rxcocoa
- Lv2
- UIKit
- CollectionView
- BOJ
- Kuring
- BFS
- combine
- ํจ์คํธ์บ ํผ์ค
- arkit
- ios
- realm
- MVVM
- Flutter
- Today
- Total
lgvv98
Clean Architecture Swift #2 ๋ณธ๋ฌธ
Clean Architecture Swift #2
๐ฅ ์บ๋ฟ๋งจ 2022. 9. 29. 18:48Clean Architecture Swift #2
์ฌ๊ธฐ๋ถํฐ๋ ํด๋ฆฐ ์ํคํ ์ณ ์ฝ๋ ๋ถ์ํ ๋ด์ฉ์ ๋ฐํ์ผ๋ก ์์ ๋ฅผ ๋ง๋ค์ด๋ณด๋ ค๊ณ ํฉ๋๋ค.
ํด๋ฆฐ ์ํคํ ์ณ ์ฐ์ต์ ์ํด ReactorKit + Moya๋ฅผ ์ฌ์ฉ
๐ฟ term ๐ฟ
DTO(Data Transfer Object)
๊ณ์ธต ๊ฐ ๋ฐ์ดํฐ ๊ตํ์ ์ํด ์ฌ์ฉํ๋ ๊ฐ์ฒด๋ก, DTO๋ ๋ก์ง์ ๊ฐ์ง์ง ์๋ ๋ฐ์ดํฐ ๊ฐ์ฒด๋ฅผ ๊ฐ์ง ํด๋์ค
(๋ถ์ํ ํ๋ก์ ํธ)
https://github.com/kudoleh/iOS-Clean-Architecture-MVVM
https://tech.olx.com/clean-architecture-and-mvvm-on-ios-c9d167d9f5b3
When we develop software it is important to not only use design patterns, but also architectural patterns. There are many different architectural patterns in Software Engineering. In mobile software engineering, the most widely used are MVVM, Clean Architecture and Redux patterns.
์ฐ๋ฆฌ๊ฐ ์ํํธ์จ์ด ๊ฐ๋ฐํ ๋ design patterns ๋ฟ๋ง ์๋๋ผ architectural patterns ๋ํ ์ค์ํฉ๋๋ค.
์ํํธ์จ์ด ์์ง๋์ด๋ง์๋ ๋ค์ํ architectural patterns์ด ์์ต๋๋ค.
๋ชจ๋ฐ์ผ ์ํํธ์จ์ด ๊ณตํ์์ ๊ฐ์ฅ ๋๋ฆฌ ์ฌ์ฉ๋๋ ๊ฒ์ MVVM, ํด๋ฆฐ ์ํคํ ์ณ ๊ทธ๋ฆฌ๊ณ Redux ํจํด์ ๋๋ค.
outers layer์์ inner layers๋ก depedency rule์ ์งํค๋ ๊ฒ์ด ๊ฐ์ฅ ์ค์ํฉ๋๋ค.
Domain Layer๋ ๋น์ฆ๋์ค ๋ก์ง์ ๋ด๋นํฉ๋๋ค.
Entities, Use Cases, Repository๊ฐ ํฌํจ๋๋ฉฐ, ์ด ๊ณ์ธต์ ๋ค๋ฅธ ํ๋ก์ ํธ ๋ด์์ ์ฌ์ฌ์ฉ๋ ์ ์์ต๋๋ค.
Domain ๊ณ์ธต์๋ ๋ค๋ฅธ ๊ณ์ธต์ด ํฌํจ๋์๋ ์๋ฉ๋๋ค. ์๋ฅผ ๋ค๋ฉด์ UIKit์ด๋ SwiftUI ํน์ ๋ฐ์ดํฐ์ Mapping Codable ๋ฑ์ด ์์ต๋๋ค.
Presentation Layer๋ View์ ๊ด๋ จํ ๊ฒ๋ค์ ๋ด๋นํฉ๋๋ค. View๋ ํ๋ ์ด์์ Use Cases๋ฅผ ์คํํ๋ ViewModel์ ์ํด์ ์กฐ์ (Coordinated)๋ฉ๋๋ค.
Presentation ๊ณ์ธต์ Domain ๊ณ์ธต์๋ง ์์กดํฉ๋๋ค.
Data Layerdpsms Repository ๊ตฌํ๊ณผ ํ๋ ์ด์์ Data Source๊ฐ ํฌํจ๋ฉ๋๋ค.
Repositiries๋ ์๋ก ๋ค๋ฅธ Data Source์ ๋ฐ์ดํฐ๋ฅผ ์กฐ์ ํ๋ ์ญํ ์ ํฉ๋๋ค.
Data ๊ณ์ธต์ ์ค์ง Domain ๊ณ์ธต์๋ง ์์กดํ๋ฉฐ, Data ๊ณ์ธต์์ Network ํต์ ์ ํตํ JSON Mapping(a.k.a codable์ฌ์ฉ)์ ํ ์๋ ์์ต๋๋ค.
์์ ๊ทธ๋ํ๋ฅผ ๋ณด๋ฉด ๊ฐ ๊ณ์ธต์ ๋ชจ๋ ์ปดํฌ๋ํธ๊ฐ Domain Use Case๋ฅผ ํฅํด์ ํ๋ฅด๋๋ฐ, Data Repository ๋ถ๋ถ์์ ๋ฐ์ ๋๋ ๊ฒ์ ํ์ธํ ์ ์๋ค. ์ด๋ interfaces(protocols)๋ฅผ ์ฌ์ฉํ์ฌ ๋ฐ์ !
โ ํด๋ฆฐ ์ํคํ ์ณ ์ฐ์ต โ
โ ๊ฒฐ๊ณผ UI โ
ํด๋ฆฐ ์ํคํ ์ณ ์์ฑ์์ ํ!
1. ์ํฐํฐ
2. DTO
3. ServiceAPI
4. Repository
5. useCase
6. ๋ ํฌ์งํ ๋ฆฌ ์ํ(๋คํธ์ํฌ ์์ฒญ ๋ฐ ์ปจ๋ฒํธ)
7. ViewController, Reactor
'apple > ๐ก DesignPattern & Architecture' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
Clean Architecture Swift #1 (0) | 2022.09.23 |
---|---|
[Swift] Coodinator Pattern (2) | 2022.07.07 |
[Swift] Command Pattern (1) | 2022.07.05 |
[Swift] Composite Pattern (1) | 2022.06.15 |
[Swift] Mediator Pattern (1) | 2022.06.15 |