728x90
๋ฐ˜์‘ํ˜•
[Clean Architecture] iOS Clean Architecture + MVVM ๊ฐœ๋…๊ณผ ์˜ˆ์ œ

repositoryํŒจํ„ด์ด๋ž€ Interfaces > Repositories์— ์žˆ๋Š” ํŒŒ์ผ๋“ค์€ ๋ชจ๋‘ ํ”„๋กœํ† ์ฝœ์ด๊ณ  Data > Repositories ์— ์žˆ๋Š” ํŒŒ์ผ๋“ค์€ Domain > Interfaces > Repositories์˜ ํ”„๋กœํ† ์ฝœ๋“ค์„ ์ฑ„ํƒํ•œ ํด๋ž˜์Šค๋“ค์ž…๋‹ˆ๋‹ค. ์•„๋ž˜ ๊ทธ๋ฆผ์ฒ˜๋Ÿผ Repository๋Š” Domain Layer์™€ Data Layer ์ค‘๊ฐ„์ฏค์— ์žˆ์–ด์„œ ์ €๋ ‡๊ฒŒ ํ”„๋กœ์ ํŠธ๊ฐ€ ๊ตฌ์„ฑ๋˜์—ˆ๋‹ค๊ณ  ์ƒ๊ฐํ•˜์‹œ๋ฉด ๋ฉ๋‹ˆ๋‹ค-!! ๊ทธ๋ฆฌ๊ณ  ๊ฐ๊ฐ์˜ Layer๋“ค์„ ๊ทธ๋ฃนํ•‘ํ•œ ๊ฒƒ์„ ์ž์„ธํžˆ ์‚ดํŽด๋ณผ๊ฒŒ์š”! 1. Domain Layer - ํด๋ฆฐ์•„ํ‚คํ…์ณ ์›์—์„œ Entities๊ณผ Use Cases๋ฅผ ๋ฌถ์–ด์„œ Domain Layer๋ผ๊ณ  ํ•ฉ๋‹ˆ๋‹ค. - ์ด ๋ ˆ์ด์–ด๋Š” ๋‹ค๋ฅธ ๋ ˆ์ด์–ด๋“ค์—๊ฒŒ ์–ด๋– ํ•œ ์˜ํ–ฅ๋„ ๋ฐ›์ง€ ์•Š์Šต๋‹ˆ๋‹ค. - ๋‹ค๋ฅธ ํ”„๋กœ์ ํŠธ์— ์˜ํ•˜์—ฌ์„œ ์žฌ์‚ฌ์šฉ ๋  ์ˆ˜..

๐Ÿ/Design Pattern 2020. 7. 17. 16:02
[Design Pattern] RepositoryํŒจํ„ด์ด๋ž€

[1] Repository ํŒจํ„ด์ด๋ž€ ๋ฐ์ดํ„ฐ ์ถœ์ฒ˜(๋กœ์ปฌ DB์ธ์ง€ API์‘๋‹ต์ธ์ง€ ๋“ฑ)์™€ ๊ด€๊ณ„ ์—†์ด ๋™์ผ ์ธํ„ฐํŽ˜์ด์Šค๋กœ ๋ฐ์ดํ„ฐ์— ์ ‘์†ํ•  ์ˆ˜ ์žˆ๋„๋ก ๋งŒ๋“œ๋Š” ๊ฒƒ์„ Repository ํŒจํ„ด์ด๋ผ๊ณ  ํ•ฉ๋‹ˆ๋‹ค. - viewModel ๋ฐ‘์— Repository๋ผ๋Š” layer๋ฅผ ํ•˜๋‚˜ ๋” ๋‘์–ด์„œ viewModel์€ ์˜ค์ง ๋น„์ฆˆ๋‹ˆ์Šค๋กœ์ง๋งŒ ์ง‘์ค‘ํ•˜๊ฒŒ ํ•ฉ๋‹ˆ๋‹ค. (๋ฐ์ดํ„ฐ๋ฅผ ๋กœ์ปฌ๊ณผ ์„œ๋ฒ„ ์ค‘ ์–ด๋””์„œ ๊ฐ€์ ธ์˜ฌ์ง€, ๋˜ ์–ด๋–ป๊ฒŒ ๊ฐ€๊ณตํ• ์ง€๋Š” Repostitory๊ฐ€ ํ•˜๊ธฐ ๋•Œ๋ฌธ์ž…๋‹ˆ๋‹ค.) - viewModel๋“ค๊ฐ„ Repository๋ฅผ ๊ณต์œ ํ•ด์„œ ๋ฐ์ดํ„ฐ ์ผ๊ด€์„ฑ์„ ์œ ์ง€ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. [2] ์˜ˆ์ œ ์ฝ”๋“œ ์œ„์˜ ์ฝ”๋“œ๋ฅผ ๋ณด๋ฉด Repository๋Š” ์„œ๋ฒ„์—์„œ ๋ฐ์ดํ„ฐ๋ฅผ ๋‹ค๋ฃจ๋Š” dataTransferService์™€ ์ฝ”์–ด๋ฐ์ดํ„ฐ(๋กœ์ปฌ)์—์„œ ๋ฐ์ดํ„ฐ๋ฅผ ๋‹ค๋ฃจ๋Š” moviesQueriesP..

๐Ÿ/Design Pattern 2020. 7. 17. 10:07
[CleanSwift] ํด๋ฆฐ์Šค์œ„ํ”„ํŠธ(Clean Swift)์— ๋Œ€ํ•ด ์•Œ์•„๋ณด์ž

Clean Swift ์•„ํ‚คํ…์ณ์— ๋Œ€ํ•ด ์•Œ์•„๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค. Clean Swift HandBook ์˜ ๋‚ด์šฉ์„ ๊ฐ„๋‹จ ์ •๋ฆฌํ•ด๋ณด๋ ค๊ณ  ํ•ฉ๋‹ˆ๋‹ค. [1] Clean Swift๊ฐ€ ๋‚˜์˜ค๊ฒŒ ๋œ ๋ฐฐ๊ฒฝ ๋„ˆ๋Š” MVC ํŒจํ„ด์˜ ๋ฌธ์ œ์ ์„ ์ธ์‹ํ•˜๊ณ (๋ฐฉ๋Œ€ํ•œ ๋ทฐ์ปจํŠธ๋กค๋Ÿฌ) MVVM๋‚˜ VIPER๋ฅผ ์‚ฌ์šฉํ•˜๋ ค๊ณ  ํ–ˆ์„ ๊ฒƒ์ด๋‹ค. ํ•˜์ง€๋งŒ ์šฐ๋ฆฌ๊ฐ€ ๋ดค์„ ๋•Œ ์ด ์•„ํ‚คํ…์ณ๋“ค๋„ ๋ถ€์กฑํ•˜๋‹ค(??) 1. MVVM ๋‹จ์ˆœํžˆ massiveness๊ฐ€ viewController์—์„œ viewModel๋กœ ์ด๋™ํ•œ๋‹ค. ๋„ˆ๋Š” massive view controllers ๋Œ€์‹  massive view models๋ฅผ ์–ป๊ฒŒ ๋˜๋Š” ๊ฒƒ์ด๋‹ค. MVVM๋Š” RxSwift์™€ ํ•จ๊ป˜ ์“ฐ๋ฉด์„œ ์ธ๊ธฐ๊ฐ€ ๋Š˜์—ˆ๋‹ค. ํ•˜์ง€๋งŒ ๋Œ€๋ถ€๋ถ„ ๋„ˆ๋Š” reactiveness๊ฐ€ ํ•„์š”ํ•˜์ง€ ์•Š๋‹ค. (์‹ค์‹œ๊ฐ„ ์ฑ„ํŒ…์„ ๋งŒ๋“ค์ง€ ์•Š๋Š” ์ด์ƒ.) =>..

๐Ÿ/Design Pattern 2020. 4. 29. 01:33
[ReactorKit] ReactorKit ์˜ˆ์ œ ๋”ฐ๋ผํ•˜๊ธฐ

ReactorKit์œผ๋กœ ๋‹จ๋ฐฉํ–ฅ ๋ฐ˜์‘ํ˜• ์•ฑ ๋งŒ๋“ค๊ธฐ(์ „์ˆ˜์—ด) ์˜ ๋ผ์ด๋ธŒ ์ฝ”๋”ฉ ์˜ˆ์ œ๋ฅผ ๋”ฐ๋ผํ•ด๋ณธ ๊ฒƒ์„ ์ •๋ฆฌ -- !! ์šฐ์„  ReactorKit์— ๋Œ€ํ•œ ๊ฐœ๋…์€ ๋ฏธ๋””์—„ ๊ณผ ์Šฌ๋ผ์ด๋“œ ์— ์ž˜ ์„ค๋ช…๋˜์–ด์žˆ์Šต๋‹ˆ๋‹ค. ๊ฐ„๋‹จํžˆ ํ”Œ๋กœ์šฐ๋งŒ ๋ณด์ž๋ฉด 1. View๋Š” Action(์‚ฌ์šฉ์ž ์ž…๋ ฅ ๋“ฑ)์„ Reactor์—๊ฒŒ ์ „๋‹ฌํ•œ๋‹ค 2. Reactor๋Š” ์ „๋‹ฌ๋ฐ›์€ Action์— ๋”ฐ๋ผ ๋น„์ฆˆ๋‹ˆ์Šค ๋กœ์ง์„ ์ˆ˜ํ–‰ํ•œ๋‹ค. 3. ๊ทธ ํ›„ Reactor๋Š” ์ƒํƒœ๋ฅผ ๋ณ€๊ฒฝํ•˜์—ฌ View์—๊ฒŒ ์ „๋‹ฌํ•œ๋‹ค Reactor๋ฅผ ์ข€ ๋” ์ž์„ธํžˆ ๋“ค์—ฌ๋‹ค๋ณด๋ฉด ์ด๋Ÿฐ ๊ทธ๋ฆผ์ž…๋‹ˆ๋‹ค Reactor๋Š” Action์ด ๋“ค์–ด์˜ค๋ฉด ๋‘ ๋‹จ๊ณ„์— ๊ฑฐ์ณ์„œ State๋ฅผ ๋ณ€๊ฒฝํ•˜๋Š” ๊ฒƒ์„ ๋ณผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค 1. mutate() ํ•จ์ˆ˜ - Action ์ŠคํŠธ๋ฆผ์„ Mutation ์ŠคํŠธ๋ฆผ์œผ๋กœ ๋ณ€ํ™˜ํ•˜๋Š” ์—ญํ•  - ์ด๊ณณ์—์„œ ๋„คํŠธ์›Œํ‚น์ด๋‚˜ ..

๐Ÿ/Design Pattern 2019. 11. 5. 22:56
[MVVM] MVVM ์˜ ๋‹ค์–‘ํ•œ ์˜ต์…˜๋“ค

iOS ๋””์ž์ธ ํŒจํ„ด(MVC/MVVM/VIPER/Clean Swift/MVC-C /MVVM-C ) ์„ ๋‹ค ์“ฐ์ง€ ๋ชปํ–ˆ์ง€๋งŒ...!ใ… ใ…  ์ผ๋‹จ ์ •๋ฆฌ MVVM๋„ ๋‹ค์–‘ํ•œ ์ข…๋ฅ˜๊ฐ€ ์žˆ์–ด์„œ ์ •๋ฆฌ๋ฅผ ํ•ด๋ณด๊ณ ์ž ํ•œ๋‹ค ViewModel์ด Model์„ ๋‹ค๋ฃจ๊ณ  View๋Š” ๋‹ค๋ฃจ์ง€ ์•Š๋Š”๋‹ค๋Š” ์ปจ์…‰์€ ๋™์ผํ•˜๊ณ  ๋‘๊ฐ€์ง€ ์˜ต์…˜์„ ์„ ํƒํ•˜์—ฌ ์“ฐ๋Š” ๊ฒƒ ๊ฐ™๋‹ค 1) ViewModel์ด Coordinator(Navigation์„ ๋‹ด๋‹นํ•˜๋Š” ๋…€์„)์—๊ฒŒ ๋งํ•˜๋Š๋ƒ ์•ˆํ•˜๋Š๋ƒ MVVM์—์„œ๋Š” Navigation ๊ด€๋ จ ์ฝ”๋“œ๋ฅผ Coordinator ๋˜๋Š” Navigtor๋ผ๋Š” ๋…€์„์—๊ฒŒ ๋‹ค ๋งก๊ธด๋‹ค. ๋ณดํ†ต Coordinator๋ผ๊ณ  ๋งŽ์ด ๋ถ€๋ฅด๊ณ  ์ด๋Ÿฐ ๋””์ž์ธ ํŒจํ„ด์„ MVVM-C ๋ผ๊ณ  ๋ถ€๋ฅธ๋‹ค. ์ด Coordinator์—๊ฒŒ "์—ฌ๊ธฐ ํ™”๋ฉด์œผ๋กœ ์ด๋™ ์ข€ ํ•ด์ฃผ์„ธ์š”~" ํ•˜๋Š” ์š”์ฒญ์„ ViewMo..

๐Ÿ/Design Pattern 2019. 7. 4. 01:49
[Design Pattern] iOS ๋””์ž์ธ ํŒจํ„ด 1ํƒ„ (MVC/MVVM/VIPER/MVC-C/MVVM-C)

[1] MVC (Model-View-Controller) * ์žฅ์  1) ์—ญํ• ๋ถ„๋‹ด์„ ๊ณ ๋ คํ•œ ๊ตฌ์กฐ๋ฅผ ๋น ๋ฅด๊ฒŒ ๊ตฌํ˜„ ํ•  ์ˆ˜ ์žˆ์Œ * ๋‹จ์  1) MVC๋Š” MVC (Massive View Controller) ?!!? Model์— ๋„ฃ๊ธฐ๋„ ์• ๋งคํ•˜๊ณ  View์—๋„ ๋„ฃ๊ธฐ ์• ๋งคํ•œ ์ฝ”๋“œ๋“ค์€ ๋ชจ๋‘ Controller์— ๋“ค์–ด๊ฐ€๊ฒŒ ๋˜์–ด์„œ Controller๊ฐ€ ๋น„๋Œ€ํ•ด์ง„๋‹ค ๊ทธ๋ž˜์„œ MVC๋ฅผ Massive View Controller๋ผ๊ณ  ํ’์žํ•˜๊ธฐ๋„ ํ•œ๋‹ค...! ex) ๋‚ ์งœ ๋ฐ์ดํ„ฐ๋ฅผ ๊ฐ ๊ตญ๊ฐ€๋ณ„ ์–‘์‹์œผ๋กœ ํฌ๋งทํ•˜๋Š” ์ฝ”๋“œ. ๋น„์ฆˆ๋‹ˆ์Šค ๋กœ์ง์ด๋‚˜ ๋ฐ์ดํ„ฐ๋ผ๊ณ  ๋ณด๊ธฐ๋„ ์–ด๋ ต๊ณ  UI๋ผ๊ณ  ๋ณด๊ธฐ๋„ ์–ด๋ ต๋‹ค ๊ฒฐ๊ตญ ์ด์™€๊ฐ™์€ Formatting ๋‹ด๋‹น์ฝ”๋“œ๋“ค์€ Controller์— ๋“ค์–ด๊ฐ€๊ฒŒ ๋œ๋‹ค 2) ์• ํ”Œ์˜ MVC ํŒจํ„ด์—์„œ๋Š” View์™€ Controller๊ฐ€ ๋„ˆ๋ฌด ์นœํ•จ ์• ..

๐Ÿ/Design Pattern 2019. 3. 25. 00:39
๊ณต์ง€์‚ฌํ•ญ
Total
256,708
Today
804
Yesterday
971
๋งํฌ
«   2021/06   »
์ผ ์›” ํ™” ์ˆ˜ ๋ชฉ ๊ธˆ ํ† 
    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      
๊ธ€ ๋ณด๊ด€ํ•จ