Skip to content

๐Ÿฆ๋ผ์ด์˜จํ•˜ํŠธ๐Ÿฆ

Notifications You must be signed in to change notification settings

Team-LionHeart/LionHeart-iOS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿฆ ํ•˜๋ฃจ 10๋ถ„, ์ข‹์€ ์•„๋น ๊ฐ€ ๋˜๋Š” ๋ฐฉ๋ฒ•

LionHeart_MainImage

๋ผ์ด์˜จํ•˜ํŠธ๋Š” โ€˜์‚ฌ์ž์˜ ์šฉ๊ธฐโ€™๋ฅผ ์˜๋ฏธํ•ฉ๋‹ˆ๋‹ค.
ํƒœ์–ด๋‚˜ ์ฒ˜์Œ์œผ๋กœ ์•„๋น ๊ฐ€ ๋œ ์–ด๋ฅธ๋“ค์ด ๊ฐ•ํ•˜๊ณ  ๋˜‘๋˜‘ํ•œ ๋ถ€๋ชจ๊ฐ€ ๋  ์ˆ˜ ์žˆ๋„๋ก,
์„ธ์ƒ์—์„œ ๊ฐ€์žฅ ์‰ฌ์šด ๋ฐฉ๋ฒ•์„ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค.


ํ”„๋กœ์ ํŠธ ๊ธฐ๊ฐ„


LionHeart_Flow


๋ฆฌํŒฉํ„ฐ๋ง ์ฐธ์—ฌ ์ธ์›

ffalswo2 kimscastle cchanmi

3์ฐจ ๋ฆฌํŒฉํ„ฐ๋ง

Unit test ๋ชฉํ‘œ

Test ์ ์šฉ ๋Œ€์ƒ๋“ค ๊ฐ๊ฐ ์ปค๋ฒ„๋ฆฌ์ง€ 70% ์ด์ƒ

Unit test์˜ ์ ์šฉ

Manager Layer


ViewModel Layer

  • NavigationDummy

    • ViewModel์—์„œ Coordinator๋กœ ์˜ฌ๋ฐ”๋ฅธ flow type์„ ์ „๋‹ฌํ•˜๋Š” ๊ฒƒ ๊นŒ์ง€๋งŒ ํ…Œ์ŠคํŠธ๋ฅผ ์ง„ํ–‰ํ•˜๊ธฐ ๋•Œ๋ฌธ์—, ViewModel์— ํ•„์š”ํ•œ ์˜์กด์„ฑ ๊ฐ์ฒด์˜ ์ž๋ฆฌ๋งŒ ์ฑ„์›Œ์ฃผ๋Š” ์šฉ๋„๋กœ Dummy๋ฅผ ์‚ฌ์šฉํ–ˆ์Šต๋‹ˆ๋‹ค.
  • ManagerStub

    • URLSessionStub๋ฅผ ํ™œ์šฉํ•ด ManagerLayer์˜ ๋กœ์ง ๊ฒ€์ฆ์ด ์™„๋ฃŒ๋œ ์ƒํƒœ์ด๊ธฐ๋•Œ๋ฌธ์— ManagerStub๋ฅผ ํ™œ์šฉํ•ด ViewModel Layer์˜ ๋กœ์ง์„ ๊ฒ€์ฆํ–ˆ์Šต๋‹ˆ๋‹ค.
  • ๊ด€๋ จ PR (๋ณ€๊ฒฝ ์ด์ „ ViewController Test ํฌํ•จ)


ViewController Layer

  • ViewModelSpy

    • ViewModel Layer์˜ unit test๋ฅผ ํ†ตํ•ด์„œ ๊ฒ€์ฆ๋œ๋กœ์ง์€ input์— ๋”ฐ๋ฅธ ์˜ฌ๋ฐ”๋ฅธ ๊ฐ’์ด output์œผ๋กœ ๋ฐ˜ํ™˜๋˜๋Š”๊ฐ€ ์˜€๊ธฐ๋•Œ๋ฌธ์— ๋‹จ์ˆœํžˆ ViewController์—์„œ ๋™๊ธฐ์ ์œผ๋กœ ํŠน์ •Data๊ฐ€ ๋“ค์–ด์™”๋‹ค๊ณ  ๊ฐ€์ •ํ•˜๊ณ  unit test๋ฅผ ์ง„ํ–‰ํ•˜๋ ค ํ–ˆ์Šต๋‹ˆ๋‹ค.
    • ํ•˜์ง€๋งŒ viewModel์˜ output์ด ViewController๋กœ ์›ํ•˜๋Š” ์‹œ์ ์— ์ž˜ ๋“ค์–ด์™€ ๋ฐ˜์˜ ๋˜์—ˆ๋Š”์ง€๋ฅผ ๊ฒ€์ฆํ•ด์•ผ ์œ ์˜๋ฏธํ•˜๋‹ค๊ณ  ์ƒ๊ฐํ•ด, viewModel์˜ output์ด viewController๋กœ ์ž˜ ๋“ค์–ด์˜ค๋Š”์ง€ ๊ทธ๋ฆฌ๊ณ  ๋ฐ์ดํ„ฐ๊ฐ€ UI ์ปดํฌ๋„ŒํŠธ๋“ค์— ์ž˜ ์ ์šฉ์ด ๋˜์—ˆ๋Š”์ง€๋ฅผ ๋น„๋™๊ธฐ ํ…Œ์ŠคํŠธํ•˜๋Š” ๋ฐฉ์‹์œผ๋กœ ๋ณ€๊ฒฝํ–ˆ์Šต๋‹ˆ๋‹ค.
  • ๊ด€๋ จ PR

  • API Unit Test PR


ViewModel์„ Stub๊ฐ€ ์•„๋‹Œ Spy๋กœ ๋งŒ๋“  ์ด์œ 

ViewController๋Š” event์„ ViewModel์— ์ „๋‹ฌํ•ด์ฃผ๊ณ , Output์„ ํ†ตํ•ด ๊ฐ’์ด ๋ณ€ํ•˜๋ฉด UI์— ๋ฐ์ดํ„ฐ๋ฅผ ์˜ฌ๋ฐ”๋ฅด๊ฒŒ ์ ์šฉ์„ ํ•˜๋Š” ์ฑ…์ž„์„ ๊ฐ€์ง€๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค.
๋”ฐ๋ผ์„œ ViewModel์ด โ€œViewController๊ฐ€ ์ „๋‹ฌํ•œ ์ด๋ฒคํŠธโ€๋ฅผ ์ œ๋Œ€๋กœ ์ˆ˜์‹ ํ–ˆ๋Š”์ง€๋ฅผ ํ™•์ธํ•˜๊ธฐ ์œ„ํ•œ ํ–‰์œ„ ๊ฒ€์ฆ์ด ํ•„์š”๋กœ ํ•ฉ๋‹ˆ๋‹ค.
์ถ”๊ฐ€๋กœ, ๋ฏธ๋ฆฌ ์ง€์ •ํ•œ Output์„ ๋ณด๋ƒ„์œผ๋กœ์จ ViewController์˜ Output binding ๋™์ž‘์„ ๊ฒ€์ฆํ•˜๊ธฐ ์œ„ํ•ด ๊ฐ€์งœ ๊ฐ์ฒด๋ฅผ ๋ฐ›์Šต๋‹ˆ๋‹ค. ์ด๋Š” ์ƒํƒœ ๊ฒ€์ฆ์— ์†ํ•ฉ๋‹ˆ๋‹ค.

๋”ฐ๋ผ์„œ โ€œํ–‰์œ„โ€์™€ โ€œ์ƒํƒœโ€๋ฅผ ๋ชจ๋‘ ๊ฒ€์ฆํ•˜๊ธฐ์— ViewModel Spy๋กœ ๊ตฌ์„ฑํ•˜์˜€์Šต๋‹ˆ๋‹ค.


2์ฐจ ๋ฆฌํŒฉํ„ฐ๋ง

๊ธฐ์กด MVC-CํŒจํ„ด์—์„œ ์™„์ „ํ•œ ๋กœ์ง๋ถ„๋ฆฌ๋ฅผ ์œ„ํ•œ MVVM-CํŒจํ„ด์œผ๋กœ ๋ฆฌํŒฉํ„ฐ๋ง, ๋ฐ์ดํ„ฐ ๋ฐ”์ธ๋”ฉ์˜ ๊ฒฝ์šฐ์—” combine์„ ํ™œ์šฉ

Lion Heart MVVM ๋ฆฌํŒฉํ„ฐ๋ง ์›์น™

viewModel์€ input๊ณผ output์˜ ๊ตฌ์กฐ๋กœ ์„ค๊ณ„ํ›„ combine์„ ํ™œ์šฉํ•ด data binding์„ ๊ตฌํ˜„

  • ViewController์ชฝ์—์„œ ๋ฐ›๋Š” Publisher์˜ errortype์€ ํ•ญ์ƒ Never type์œผ๋กœ ๊ตฌ์„ฑํ–ˆ์Šต๋‹ˆ๋‹ค.

UI๋Š” error๋ฅผ ์•Œํ•„์š”๊ฐ€ ์—†์ด ๋‹จ์ˆœํžˆ action์œผ๋กœ ViewModel์— ๊ฐ’๋งŒ ๋„˜๊ฒจ์ฃผ๋ฉด๋˜๋ฉฐ, ViewController์—์„œ completion์— ํ•ด๋‹นํ•˜๋Š” error๋ฅผ ๋ฐ›๊ฒŒ๋˜๋ฉด stream์ด ๋Š์–ด์ง€๊ณ , ๋Š์–ด์ง„ stream์—์„œ ๋ณธ๋ž˜ ๋ฐ›๊ณ ์ž ํ•˜๋Š” user input์€ ํ™”๋ฉด์„ ์žฌ์ง„์ž…ํ•˜์ง€ ์•Š๋Š” ์ด์ƒ ์–ด๋– ํ•œ ์š”์ฒญ๋„ ๋ฐ›์ง€ ๋ชปํ•˜๊ฒŒ ๋˜๊ธฐ ๋•Œ๋ฌธ์ž…๋‹ˆ๋‹ค.

  • navigation์„ ๊ด€๋ฆฌํ•˜๋Š” publisher๋ฅผ ViewModel๋‚ด๋ถ€์—์„œ ๊ตฌํ˜„ํ•˜๊ณ  ํŠน์ • input์—๋”ฐ๋ผ ํ™”๋ฉด์ „ํ™˜ ํƒ€์ž…์„ ๋„˜๊ฒจ์ฃผ๊ณ  navigation publisher๊ฐ€ ํƒ€์ž…์—๋”ฐ๋ผ ํ™”๋ฉด์ „ํ™˜๋‹ด๋‹น ๊ฐ์ฒด์ธ coordintor์˜ ๋ฉ”์„œ๋“œ ํ˜ธ์ถœํ•˜๋Š” ๊ตฌ์กฐ๋ฅผ ๊ฐ€์ง‘๋‹ˆ๋‹ค.

์—ฌ์ „ํžˆ ViewModel์„ ์˜์กด์„ฑ์ฃผ์ž…ํ•˜๋Š” ์ด์œ 

DIP์˜ ๋ณธ์งˆ์€ โ€œ๋ณ€ํ™”ํ•˜์ง€ ์•Š๋Š” ๊ฒƒ์— ์˜์กดํ•˜๋Š” ๊ฒƒโ€์ด๋ฉฐ โ€œ์ถ”์ƒํ™”โ€์— ์˜์กดํ•œ๋‹ค๋Š” ๋œป์ž…๋‹ˆ๋‹ค. ๊ทธ๋ฆฌ๊ณ  ์ด๋ฅผ ์œ„ํ•œ ๋„๊ตฌ๋กœ protocol์„ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค. UI์— ๊ฐ€์žฅ๊ฐ€๊นŒ์šด ViewModel์˜ ๊ฒฝ์šฐ ๋ณ€ํ™”์— ๋ฏผ๊ฐํ• ์ˆ˜์žˆ๊ธฐ์—, ViewModel protocol ๋˜ํ•œ ๋ณ€ํ™”์— ๋ฏผ๊ฐํ•ฉ๋‹ˆ๋‹ค. ์ด๋Š” DIP์˜ ๋ณธ์งˆ์— ๋งž์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ViewModel์„ ๊ตฌ์ฒด ํƒ€์ž…์„ ๋ฐ”๋ผ๋ณด๋Š” ๊ตฌ์กฐ๋„ ๊ณ ๋ ค๋ฅผ ํ–ˆ์ง€๋งŒ ํ˜„์žฌ Input-Output๊ตฌ์กฐ๋ฅผ ์ฑ„ํƒํ•˜๊ณ ์žˆ์œผ๋ฉฐ Input, Output ๊ตฌ์กฐ์ฒด ํƒ€์ž…๊ณผ transform์ด๋ผ๋Š” ๋ฉ”์„œ๋“œ๋กœ ์ถ”์ƒํ™”๋œ protocol์€ โ€œ๋ณ€ํ•˜์ง€ ์•Š๋Š” ๊ฒƒโ€์ด๋ผ๊ณ  ํŒ๋‹จํ•ด ViewModel๋˜ํ•œ DIP๋ฅผ ์ ์šฉํ•˜๊ธฐ๋กœ ๊ฒฐ์ •ํ–ˆ์Šต๋‹ˆ๋‹ค



๊ธฐ์กด async/await์„ ํ†ตํ•œ ๋„คํŠธ์›Œํ‚น + Combine ๊ฒฐํ•ฉ

async / await๊ณผ Combine์„ ๊ฒฐํ•ฉํ•œ ๋„คํŠธ์›Œํฌ ๋ฐฉ๋ฒ•

  1. ๋„คํŠธ์›Œํ‚น์‹œ completion์„ ํ†ตํ•ด ์ƒ์œ„ stream์˜ ๋Š์–ด์ง์„ ๋ฐฉ์ง€ํ•˜๊ธฐ ์œ„ํ•ด flatmap operator๋ฅผ ์‚ฌ์šฉํ•˜๊ณ , ๋‚ด๋ถ€์ ์œผ๋กœ๋Š” ๋น„๋™๊ธฐ ์ ์œผ๋กœ stream์„ ์ƒ์„ฑํ•˜๊ธฐ ์œ„ํ•œ future๋ฅผ ์‚ฌ์šฉํ•ด์„œ async/await๊ณผ Combine์„ ํ˜ผํ•ฉํ•ด์„œ ์‚ฌ์šฉํ–ˆ์Šต๋‹ˆ๋‹ค.

2. ๋„คํŠธ์›Œํฌ ํ†ต์‹ ์‹œ ๋ฐœ์ƒํ•˜๋Š” error๋ฅผ combine์˜ catch operator๋ฅผ ํ†ตํ•ด์„œ ์ตœ์ข…์ ์œผ๋กœ๋Š” error๋ฅผ never type์œผ๋กœํ•˜๋Š” stream์œผ๋กœ ๋ฐ”๊ฟ‰๋‹ˆ๋‹ค.
ํ•ด๋‹น ๊ณผ์ •์„ ํ†ตํ•ด catch๊ฐ€ ์—†์„๋•Œ์˜ ์ฝ”๋“œ์™€ ๋‹ฌ๋ผ์ง„์ ์€ flaMap์„ ํ†ตํ•ด returnํ•ด์ฃผ๋Š” Publisher์˜ Error Type์„ Never๋กœ ๋งŒ๋“ค์–ด์ค„ ์ˆ˜ ์žˆ์–ด 1๋ฒˆ ์›์น™์—์„œ์˜ UI๋Š” error๋ฅผ ์•Œํ•„์š”๊ฐ€์—†๋‹ค ๋ผ๋Š” ์›์น™์„ ์ง€ํ‚ฌ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

ํ•ด๋‹น ๋ฐฉ์‹์ด ์œ ์˜๋ฏธํ•œ ์ด์œ ๋Š” ์–ด๋–ค error๊ฐ€ ๋ฐœ์ƒํ–ˆ์„๋•Œ UI/UX์ ์ธ ๊ด€์ ์—์„œ ์œ ์ €์—๊ฒŒ ๋ณด์—ฌ์ค„์ˆ˜์žˆ๋Š” ์ตœ์†Œํ•œ์˜ UI๋Š” ๊ตฌ์„ฑ์„ ํ•ด์•ผํ•˜๊ธฐ์— default๊ฐ’์„ ๋„ฃ์–ด์ค˜ ์œ ์ €๊ฐ€ ๋ณด๊ธฐ์—๋Š” UI๊ฐ€ ๊นจ์ง€์ง€์•Š์€ view๋ฅผ ๋ณผ์ˆ˜์žˆ๊ณ , ๋‚ด๋ถ€์ ์œผ๋กœ error๋ฅผ handlingํ•ด์ฃผ๋Š” stream์„ ํ†ตํ•ด ์—๋Ÿฌ์— ๋Œ€ํ•œ ์ฒ˜๋ฆฌ๋ฅผ ํ•ด์ฃผ๋ฉด ์œ ์ €์ž…์žฅ์—์„œ๋Š” ์—๋Ÿฌ๊ฐ€ ๋ฐœ์ƒํ•œ ์‚ฌ์‹ค์„ ๋ชจ๋ฅด๊ฒŒ ์ฒ˜๋ฆฌํ•ด์ค„์ˆ˜์žˆ์–ด ๊ธ์ •์ ์ธ ์‚ฌ์šฉ์ž ๊ฒฝํ—˜์„ ์–ป์„์ˆ˜ ์žˆ๊ฒŒ ๋ฉ๋‹ˆ๋‹ค.

3. ๊ธฐ์กด์˜ delegate pattern๋Œ€์‹  combine์˜ stream์„ ํ™œ์šฉํ•œ data passing๋ฐฉ์‹์œผ๋กœ ํ†ต์ผํ–ˆ์Šต๋‹ˆ๋‹ค > cell ๋‚ด๋ถ€์˜ button action์„ ์ฒ˜๋ฆฌํ• ๋•Œ datasource๋กœ ์ธํ•ด ์ƒ์„ฑ๋˜๋Š” data stream์ด ๋ˆ„์ ๋˜๋Š” ๋ฌธ์ œ์™€ cell๋‚ด๋ถ€์—์„œ data stream์ด ์ƒ์„ฑ๋˜๋Š” ๋ฌธ์ œ๋ฅผ prepareForReuse์™€ stream์„ ์ €์žฅํ•˜๋Š” ์œ„์น˜๋ฅผ ์กฐ์ •ํ•จ์œผ๋กœ์จ ํ•ด๊ฒฐํ•ฉ๋‹ˆ๋‹ค. - [[REFACTOR] CurriculumView Diffable ๋ฐ MVVM(Combine)-C๋กœ ๋ฆฌํŒฉํ„ฐ๋ง (#179)](#187)

๊ธฐ์กด TableView, CollectionView๋ฅผ DiffableDataSource๋กœ ๋ณ€๊ฒฝ

  • ํ•ด๋‹น ์•ฑ์—์„œ๋Š” ๋ฐ์ดํ„ฐ์˜ ๋ณ€ํ™”์— ๋”ฐ๋ฅธ ์• ๋‹ˆ๋ฉ”์ด์…˜์ด ํ•„์š”ํ•œ ์ƒํ™ฉ์ด ์กด์žฌํ•˜๊ณ  ํ•ด๋‹น ๊ฒฝ์šฐ์— Snapshot์„ ํ™œ์šฉํ•ด UI/UX์ ์œผ๋กœ ๋ณด๋‹ค ๋‚˜์€ ๊ฒฝํ—˜์„ ์ œ๊ณตํ•ด์ฃผ๋Š” DiffableDataSource๋ฅผ ํ™œ์šฉํ•ด ๋ณด๋‹ค ๋” ๋‚˜์€ ์œ ์ € ๊ฒฝํ—˜์„ ์ œ๊ณตํ•  ์ˆ˜ ์žˆ๋Š” ๋ฐฉํ–ฅ์œผ๋กœ ๋ฆฌํŒฉํ„ฐ๋งํ–ˆ์Šต๋‹ˆ๋‹ค.

Cell Reuse Trouble Shooting

MVVM ์›์น™

ResultType์„ ํ†ตํ•œ error์ฒ˜๋ฆฌ์— ๋Œ€ํ•œ ๊ณ ๋ฏผ




1์ฐจ ๋ฆฌํŒฉํ„ฐ๋ง

๊ธฐ์กด MVC ํŒจํ„ด์—์„œ ViewController์˜ ์ฑ…์ž„์„ ๋ถ„๋ฆฌํ•˜๊ธฐ ์œ„ํ•œ ์—ฌ๋Ÿฌ๊ฐ€์ง€ ๋””์ž์ธํŒจํ„ด ๋ฐ ๊ตฌ์กฐ ์ ์šฉ


1. ๊ธฐ์กด ๋„คํŠธ์›Œํฌ ๋ ˆ์ด์–ด๋ฅผ singleton์—์„œ ์˜์กด์„ฑ์ฃผ์ž…๋ฐฉ์‹(Dependency Injectcion)์œผ๋กœ ๋ณ€๊ฒฝ

์ถ”ํ›„์— Unit Test ๋„์ž…์„ ๊ณ ๋ คํ•˜์—ฌ ์‘์ง‘๋„๋Š” ๋†’๊ณ  ๊ฒฐํ•ฉ๋„๋Š” ๋‚ฎ์€ ๊ฐ์ฒด ์„ค๊ณ„๋ฅผ ๋ชฉํ‘œ๋กœ ์„ค๊ณ„์— ์ž„ํ–ˆ์Šต๋‹ˆ๋‹ค. ๊ธฐ์กด์˜ ์‹ฑ๊ธ€ํ†ค ๋ฐฉ์‹์€ SRP ์›์น™๊ณผ OCP ์›์น™์— ์œ„๋ฐ˜๋˜๊ณ  ํŠน์ • ๊ฐ’์— ๋Œ€ํ•œ ํ…Œ์ŠคํŠธ๋ฅผ ์ง„ํ–‰ํ•˜๋Š”๋ฐ ์–ด๋ ค์›€์ด ์žˆ์œผ๋ฉฐ Data race์˜ ์œ„ํ—˜์„ฑ ๋˜ํ•œ ์กด์žฌํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๋”ฐ๋ผ์„œ ๊ธฐ์กด ์‹ฑ๊ธ€ํ†ค์—์„œ Dependency Injection์„ ํ†ตํ•œ ์˜์กด์„ฑ ์ฃผ์ž… ๋ฐฉ์‹์„ ๋„์ž… ๋ฐ ์ ์šฉํ–ˆ์Šต๋‹ˆ๋‹ค.


2. ์ „์ฒด UI ์ปดํฌ๋„ŒํŠธ ๋ถ„๋ฆฌ, ๋””์ž์ธ์‹œ์Šคํ…œ ๊ตฌ์ถ• ๋ฐ ์ ์šฉ

ํŒ€ ๋‚ด์—์„œ ๋ฐ˜๋ณตํ•ด์„œ ์“ฐ์ด๋Š” UIComponent์˜ ๊ฒฝ์šฐ์— ๋ฐ˜๋ณต๋˜๋Š” ์ฝ”๋“œ๊ฐ€ ๋งŽ์•„์ง€๋Š” ์ƒํ™ฉ์ด ๋ฐœ์ƒํ•ด ๊ฐ€๋…์„ฑ ์ธก๋ฉด์—์„œ ํ”ผ๋กœ๋„๊ฐ€ ๋„ˆ๋ฌด ์‹ฌํ•ด์กŒ์Šต๋‹ˆ๋‹ค. ์ž์ฃผ ์“ฐ์ด๋Š” Component๋“ค์—์„œ ๊ณตํ†ต์ ์œผ๋กœ ์“ฐ์ด๋Š” ํŒŒ๋ผ๋ฏธํ„ฐ๋“ค์„ ์ธ์ž๋กœ ๋ฐ›์•„ ํŽธํ•˜๊ฒŒ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋„๋ก ๋ผ์ด์˜จํ•˜ํŠธ์˜ ๋””์ž์ธ์‹œ์Šคํ…œ์„ ๊ตฌ์ถ•ํ•˜๊ณ  ์ ์šฉํ–ˆ์Šต๋‹ˆ๋‹ค.


3. ViewController์˜ ํ™”๋ฉด ์ „ํ™˜ ์ฑ…์ž„์„ ๋‹ด๋‹นํ•ด ์ค„ Coordinator Pattern ๋„์ž…

ViewController๋Š” UI ๊ด€๋ จ ๊ฐ์ฒด์ด๊ธฐ ๋•Œ๋ฌธ์—, ์‚ฌ์šฉ์ž ํ๋ฆ„์„ ์ฒ˜๋ฆฌํ•˜๋Š”๊ฒƒ์€ ์—ญํ•  ๋ฒ”์œ„(scope)๋ฅผ ๋ฒ—์–ด๋‚œ๋‹ค๊ณ  ์ƒ๊ฐํ–ˆ์Šต๋‹ˆ๋‹ค. ๋˜ํ•œ, MVC์˜ ๋‹จ์ ์ธ ViewController์˜ ์—ญํ• ์ด ๋น„๋Œ€ํ•ด์ง€๋Š” ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ•˜๊ธฐ ์œ„ํ•ด ํ™”๋ฉด์ „ํ™˜ ์ฑ…์ž„ ์ „๋‹ด์„ ์œ„ํ•œ Coordintor Pattern์„ ๋„์ž… ๋ฐ ์ ์šฉํ–ˆ์Šต๋‹ˆ๋‹ค.


4. Coodinator ๊ฐ์ฒด ๋‚ด์—์„œ ViewController ๊ฐ์ฒด ์ƒ์„ฑ ์ฑ…์ž„ ๋ถ„๋ฆฌ๋ฅผ ์œ„ํ•œ Factory Pattern ๋„์ž…

DI๋กœ์ธํ•ด ViewController ๊ฐ์ฒด ์ƒ์„ฑ์‹œ ์™ธ๋ถ€ ๊ฐ์ฒด ์ƒ์„ฑ ๋ฐ ์ฃผ์ž…์˜ ๋ถˆํŽธํ•จ์ด ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค. ์ด๋ฅผ ํ•ด๊ฒฐํ•˜๊ธฐ ์œ„ํ•ด Custom DI Container, Swinject, Factory Pattern ๊ฐ™์€ ์—ฌ๋Ÿฌ ๋ฐฉ๋ฒ•๋ก ์„ ํ†ตํ•œ ๋ฌธ์ œ ํ•ด๊ฒฐ์„ ๊ณ ๋ฏผํ–ˆ์Šต๋‹ˆ๋‹ค. ๊ฒฐ๋ก ์ ์œผ๋กœ Factory Pattern์ด ๋ผ์ด์˜จํ•˜ํŠธ ํ”„๋กœ์ ํŠธ ๊ทœ๋ชจ์™€ ๊ตฌ์กฐ๋ฅผ ๊ณ ๋ คํ–ˆ์„ ๋•Œ, ๊ฐ€์žฅ ์ ํ•ฉํ•˜๋‹ค๊ณ  ์ƒ๊ฐํ•ด ๋„์ž… ๋ฐ ์ ์šฉํ–ˆ์Šต๋‹ˆ๋‹ค.


5. ViewController์™€ Coordinator๊ฐ„์˜ ์™„์ „ํ•œ ๊ด€์‹ฌ์‚ฌ ๋ถ„๋ฆฌ ๋ฐ ์บก์Šํ™”๋ฅผ ์œ„ํ•œ Adaptor Pattern ๋„์ž…

Delegate ํŒจํ„ด์œผ๋กœ์ธํ•ด Coordinator๊ฐ€ ViewController์—์„œ์˜ User Action์„ ์ถ”๋ก ํ•  ์ˆ˜ ์žˆ๊ฒŒ ๋˜์—ˆ๊ณ  ๋”ฐ๋ผ์„œ ์™„์ „ํ•œ ๊ด€์‹ฌ์‚ฌ ๋ถ„๋ฆฌ๊ฐ€ ๋ถˆ๊ฐ€๋Šฅํ•˜๊ฒŒ ๋˜์—ˆ์Šต๋‹ˆ๋‹ค. Coordinator๋Š” flow์— ๋Œ€ํ•œ ์ฑ…์ž„๋งŒ์„ ๊ฐ€์ง€๊ณ  ์žˆ์–ด์•ผ ํ•œ๋‹ค๊ณ  ์ƒ๊ฐํ–ˆ๊ณ , Coordinator์™€ ViewController์˜ ์™„์ „ํ•œ ๊ด€์‹ฌ์‚ฌ ๋ถ„๋ฆฌ๋ฅผ ์œ„ํ•ด ๋‘ ๊ฐ€์ง€ Interface๋ฅผ ์—ฐ๊ฒฐํ•ด ์ฃผ๋Š” Adaptor Pattern์„ ๋„์ž… ๋ฐ ์ ์šฉํ–ˆ์Šต๋‹ˆ๋‹ค.



UI ์„ค๊ณ„ ๋ฐ ๊ตฌํ˜„

UI ์„ค๊ณ„ ๋ฐ ๊ตฌํ˜„(1์ฐจ ํ”„๋กœ์ ํŠธ)



๐ŸŽ LionHeart-iOS Developers

๊น€๋ฏผ์žฌ ๊น€์˜์„ฑ ๊น€๋™ํ˜„ ๊ณฝ์„ฑ์ค€ ํ™ฉ์ฐฌ๋ฏธ
ffalswo2 kimscastle BrickSky sjk4618 cchanmi
ํ”„๋กœ์ ํŠธ ์„ค๊ณ„
๋กœ๊ทธ์ธ ์œ ์ € ํ”Œ๋กœ์šฐ
์Šคํ”Œ๋ž˜์‹œ ๋ทฐ
์•„ํ‹ฐํด ์ƒ์„ธ๋ทฐ
ํ”„๋กœ์ ํŠธ ์„ค๊ณ„
์˜จ๋ณด๋”ฉ
๋ฉ”์ธ ๋ทฐ
๋””์ž์ธ์‹œ์Šคํ…œ
ํƒ์ƒ‰ ๋ทฐ
์ฑŒ๋ฆฐ์ง€ ๋ทฐ
์ปค๋ฆฌํ˜๋Ÿผ ๋ทฐ
์ฃผ์ฐจ๋ณ„ ๋ฆฌ์ŠคํŠธ ๋ทฐ
๋ถ๋งˆํฌ ๋ทฐ
๋งˆ์ดํŽ˜์ด์ง€ ๋ทฐ

๐Ÿ’ป Development Environment


๐Ÿ“– Using Library

Library Tag Tool
SnapKit Layout SPM
Lottie Splash, Animation SPM
FireBase ํ‘ธ์‹œ์•Œ๋ฆผ SPM
KaKaoOpenSDK ์†Œ์…œ๋กœ๊ทธ์ธ SPM

๐Ÿ“ Coding Convention, Git flow

๐Ÿ“ Foldering

LionHeart-iOS
โ”œโ”€โ”€ LionHeart-iOS
โ”‚ย ย  โ”œโ”€โ”€ Application
โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ AppDelegate.swift
โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ Base.lproj
โ”‚ย ย  โ”‚ย ย  โ”‚ย ย  โ””โ”€โ”€ LaunchScreen.storyboard
โ”‚ย ย  โ”‚ย ย  โ””โ”€โ”€ SceneDelegate.swift
โ”‚ย ย  โ”œโ”€โ”€ Global
โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ Config.swift
โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ Extensions
โ”‚ย ย  โ”‚ย ย  โ”‚ย ย  โ””โ”€โ”€ Encodable+.swift
โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ Literals
โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ Resources
โ”‚ย ย  โ”‚ย ย  โ”‚ย ย  โ””โ”€โ”€ Assets.xcassets
โ”‚ย ย  โ”‚ย ย  โ”‚ย ย      โ”œโ”€โ”€ AccentColor.colorset
โ”‚ย ย  โ”‚ย ย  โ”‚ย ย      โ”‚ย ย  โ””โ”€โ”€ Contents.json
โ”‚ย ย  โ”‚ย ย  โ”‚ย ย      โ”œโ”€โ”€ AppIcon.appiconset
โ”‚ย ย  โ”‚ย ย  โ”‚ย ย      โ”‚ย ย  โ””โ”€โ”€ Contents.json
โ”‚ย ย  โ”‚ย ย  โ”‚ย ย      โ””โ”€โ”€ Contents.json
โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ UIComponents
โ”‚ย ย  โ”‚ย ย  โ””โ”€โ”€ Utils
โ”‚ย ย  โ”œโ”€โ”€ GoogleService-Info.plist
โ”‚ย ย  โ”œโ”€โ”€ LionHeart-iOSDebug.entitlements
โ”‚ย ย  โ”œโ”€โ”€ Network
โ”‚ย ย  โ”‚ย ย  โ””โ”€โ”€ Base
โ”‚ย ย  โ”‚ย ย      โ”œโ”€โ”€ BaseResponse.swift
โ”‚ย ย  โ”‚ย ย      โ””โ”€โ”€ HTTPHeaderField.swift
โ”‚ย ย  โ”œโ”€โ”€ Scenes
โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ Article
โ”‚ย ย  โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ ArticleCategory
โ”‚ย ย  โ”‚ย ย  โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ Cells
โ”‚ย ย  โ”‚ย ย  โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ ViewControllers
โ”‚ย ย  โ”‚ย ย  โ”‚ย ย  โ”‚ย ย  โ””โ”€โ”€ Views
โ”‚ย ย  โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ ArticleDetail
โ”‚ย ย  โ”‚ย ย  โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ Cells
โ”‚ย ย  โ”‚ย ย  โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ ViewControllers
โ”‚ย ย  โ”‚ย ย  โ”‚ย ย  โ”‚ย ย  โ””โ”€โ”€ Views
โ”‚ย ย  โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ ArticleListByCategory
โ”‚ย ย  โ”‚ย ย  โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ Cells
โ”‚ย ย  โ”‚ย ย  โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ ViewControllers
โ”‚ย ย  โ”‚ย ย  โ”‚ย ย  โ”‚ย ย  โ””โ”€โ”€ Views
โ”‚ย ย  โ”‚ย ย  โ”‚ย ย  โ””โ”€โ”€ ArticleListByWeek
โ”‚ย ย  โ”‚ย ย  โ”‚ย ย      โ”œโ”€โ”€ Cells
โ”‚ย ย  โ”‚ย ย  โ”‚ย ย      โ”œโ”€โ”€ ViewControllers
โ”‚ย ย  โ”‚ย ย  โ”‚ย ย      โ””โ”€โ”€ Views
โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ BookMark
โ”‚ย ย  โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ Cells
โ”‚ย ย  โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ ViewControllers
โ”‚ย ย  โ”‚ย ย  โ”‚ย ย  โ””โ”€โ”€ Views
โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ Curriculum
โ”‚ย ย  โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ Cells
โ”‚ย ย  โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ ViewControllers
โ”‚ย ย  โ”‚ย ย  โ”‚ย ย  โ””โ”€โ”€ Views
โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ Login
โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ MyPage
โ”‚ย ย  โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ ViewControllers
โ”‚ย ย  โ”‚ย ย  โ”‚ย ย  โ””โ”€โ”€ Views
โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ Onboarding
โ”‚ย ย  โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ Cells
โ”‚ย ย  โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ ViewControllers
โ”‚ย ย  โ”‚ย ย  โ”‚ย ย  โ””โ”€โ”€ Views
โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ Splash
โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ TabBar
โ”‚ย ย  โ”‚ย ย  โ””โ”€โ”€ Today
โ”‚ย ย  โ”‚ย ย      โ”œโ”€โ”€ Cells
โ”‚ย ย  โ”‚ย ย      โ”œโ”€โ”€ ViewControllers
โ”‚ย ย  โ”‚ย ย      โ””โ”€โ”€ Views
โ”‚ย ย  โ”œโ”€โ”€ Settings
โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ Configurations
โ”‚ย ย  โ”‚ย ย  โ”‚ย ย  โ””โ”€โ”€ Development.xcconfig
โ”‚ย ย  โ”‚ย ย  โ””โ”€โ”€ Info.plist
โ”‚ย ย  

๐Ÿฆ ๋ผ์ด์˜จํ•˜ํŠธ ๋…ธ์…˜์ด ๊ถ๊ธˆํ•˜๋‹ค๋ฉด?

์•„์š” ๋ผ์ด์˜น ๋…ธ์…˜

๐Ÿ’ฅ Troble Shotting

๊น€๋ฏผ์žฌ ํŠธ๋Ÿฌ๋ธ” ์ŠˆํŒ… ๐Ÿจ
๊น€์˜์„ฑ ํŠธ๋Ÿฌ๋ธ” ์ŠˆํŒ… ๐Ÿฆˆ
๊ณฝ์„ฑ์ค€ ํŠธ๋Ÿฌ๋ธ” ์ŠˆํŒ… ๐Ÿฆฆ
๊น€๋™ํ˜„ ํŠธ๋Ÿฌํด ์ŠˆํŒ… ๐Ÿ™
ํ™ฉ์ฐฌ๋ฏธ ํŠธ๋Ÿฌ๋ธ” ์ŠˆํŒ… ๐Ÿง

About

๐Ÿฆ๋ผ์ด์˜จํ•˜ํŠธ๐Ÿฆ

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages