Skip to content

๐Ÿก ํ•œ์ง‘์‚ด์ด ๊ฐ€๋ณด์ž๊ณ  แ••( แ› )แ•— ๐Ÿก

Notifications You must be signed in to change notification settings

TeamHous/Hous-iOS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿก Hous-iOS

KakaoTalk_Photo_2022-07-22-07-03-05


๐Ÿ  About Hous- ๐Ÿง

์šฐ๋ฆฌ์˜ House๋ฅผ ์œ„ํ•œ How is - ๐Ÿ’ก


SOPT 30th APPJAM


๐Ÿ‰ Workflow

hous_workflow


โ—๏ธAbout Service

๐Ÿ›– ํ•จ๊ป˜ ํ•œ ์ง‘์— ์‚ด๋ฉฐ ๋Š๊ผˆ๋˜ ๊ณ ๋ฏผ๊ณผ ๊ณ ์ถฉ! Hous-๊ฐ€ ํ•ด๊ฒฐํ•ด์ค„๊ป˜์š”. ๐Ÿ›–

์ฒญ์†Œ์— ๋ฏผ๊ฐํ•˜์ง€๋งŒ ๋ฃธ๋ฉ”์ดํŠธ๋Š” ์ฒญ์†Œ์— ๋ฏผ๊ฐํ•˜์ง€ ์•Š์•„์„œ ๊ฒฐ๊ตญ ๋‹ค ํ˜ผ์ž ์ฒญ์†Œํ•˜์ง€๋Š” ์•Š์œผ์…จ๋‚˜์š”?
์ „ํ˜€ ์ƒ์ฒ˜๋ฅผ ์ฃผ๋ ค๊ณ  ํ•˜์ง€ ์•Š์•˜์ง€๋งŒ, ๋ฃธ๋ฉ”์ดํŠธ์™€ ์„ฑํ–ฅ์ด ๋‹ฌ๋ผ ์ƒ์ฒ˜๋ฅผ ์ค˜๋ฒ„๋ฆฐ ์ ์ด ์žˆ์ง€๋Š” ์•Š์œผ์…จ๋‚˜์š”?
๋ฃธ๋ฉ”์ดํŠธ์™€์˜ ํ‰ํ™”๋กœ์šด ํ•œ์ง‘์‚ด์ด๋ฅผ ๋„์™€์ค„ ๋น„์„œ Hous- ์ž…๋‹ˆ๋‹ค.


๐Ÿ’ก Key Service


โœจ ์ด๋ฒคํŠธ ๋“ฑ๋ก

ํ•จ๊ป˜ํ•˜๋Š” ์ผ ํ˜น์€ ๋ฃธ๋ฉ”์ดํŠธ๋“ค์ด ์•Œ๋ฉด ์ข‹์„ ์ž์‹ ์˜ ์ผ์ •์„ ์ด๋ฒคํŠธ๋กœ ๋“ฑ๋กํ•ด ์„œ๋กœ์˜ ์ƒํ™œ์„ ๊ณต์œ ํ•  ์ˆ˜ ์žˆ๋„๋ก ํ•˜๋ฉฐ ๋‹น์ผ ์•Œ๋ฆผ์„ ํ†ตํ•ด ์žŠ์ง€ ์•Š๊ณ  ๊ธฐ์–ตํ•˜๊ฒŒ ํ•ด์คŒ.

โœจ ๊ทœ์น™ ๋“ฑ๋ก

๊ณต๋™ ์ƒํ™œ์— ํ•„์š”ํ•œ ๊ทœ์น™์„ ๋“ฑ๋กํ•˜๊ณ  ์นดํ…Œ๊ณ ๋ฆฌ๋ณ„ ๋ถ„๋ฅ˜๋ฅผ ํ†ตํ•ด ์‰ฝ๊ฒŒ ํ™•์ธํ•˜๋„๋ก ํ•จ. ์„ค์ •ํ•œ ๋‹ด๋‹น์ž์™€ ์š”์ผ์— ๋”ฐ๋ผ ์•Œ๋ฆผ์„ ๋ฐ›๊ณ  ๊ทœ์น™์„ ์ง€์ผฐ๋Š”์ง€ ์ฒดํฌํ•  ์ˆ˜ ์žˆ์Œ.

โœจ ์„ฑํ–ฅ ํ…Œ์ŠคํŠธ

ํ•˜๋ฃจ์˜ ์ƒํ™ฉ๊ณผ ์งˆ๋ฌธ์„ ์ œ์‹œํ•ด ์‘๋‹ต์„ ํ†ตํ•ด ์ƒํ™œ ์„ฑํ–ฅ์„ ํ™•์ธํ•จ. ๊ทธ๋ž˜ํ”„์™€ ์„ฑํ–ฅ ์นด๋“œ๋ฅผ ํ†ตํ•ด ํ…Œ์ŠคํŠธ ๊ฒฐ๊ณผ๋ฅผ ํ•œ ๋ˆˆ์— ๋ณผ ์ˆ˜ ์žˆ๋„๋ก ํ•˜๋ฉฐ, ์ด๋Š” ๋ฃธ๋ฉ”์ดํŠธ๊ฐ„ ์„œ๋กœ์— ๋Œ€ํ•œ ์ดํ•ด๋ฅผ ๋„์›€.


๐Ÿ›  Development Environment

Swift Xcode iOS


๐Ÿ“š Package Dependency

Name Tag Management Tool
SnapKit Layout SPM
Then Layout, Sugar API SPM
Alamofire Network SPM
Inject Build SPM
RxGesture RxLibrary SPM
RxSwift RxLibrary SPM
Lottie Splash SPM

๐Ÿ“ Project Structure

.
โ”œโ”€โ”€ Global
โ”‚ย ย  โ”œโ”€โ”€ Extension
โ”‚ย ย  โ”œโ”€โ”€ Resource
โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ Assets.xcassets
โ”‚ย ย  โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ Common
โ”‚ย ย  โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ Home
โ”‚ย ย  โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ Rules
โ”‚ย ย  โ”‚ย ย  โ”‚ย ย  โ””โ”€โ”€ Profile
โ”‚ย ย  โ”‚ย ย  โ””โ”€โ”€ Font
โ”‚ย ย  โ”œโ”€โ”€ Supports
โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ AppDelegate.swift
โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ Info.plist
โ”‚ย ย  โ”‚ย ย  โ””โ”€โ”€ SceneDelegate.swift
โ”‚ย ย  โ””โ”€โ”€ UIComponent
โ”œโ”€โ”€ Network
โ”‚ย ย  โ”œโ”€โ”€ API
โ”‚ย ย  โ”œโ”€โ”€ HTTP
โ”‚ย ย  โ””โ”€โ”€ Model
โ””โ”€โ”€ Screens
    โ”œโ”€โ”€ Home
    โ”œโ”€โ”€ Rules
    โ”œโ”€โ”€ Profile
    โ”œโ”€โ”€ Splash
    โ””โ”€โ”€ Tabbar

๐ŸŽ Hous- iOS Developers

แ„Œแ…ตแ„’แ…งแ†ซ แ„†แ…ตแ†ซแ„Œแ…ข แ„‹แ…ด์ง„ แ„’แ…ฉแ„‰แ…ฆ
๊น€์ง€ํ˜„ ๊น€๋ฏผ์žฌ ์ด์˜์ง„ ๊น€ํ˜ธ์„ธ
@Jihyun247 @ffalswo2 @pabby @psychehose


โš’๏ธ ๊ฐ์ž ๋งก์€ ๊ธฐ๋Šฅ


๊น€์ง€ํ˜„

๊ทœ์น™ํƒญ - ์นดํ…Œ๊ณ ๋ฆฌ , ์˜ค๋Š˜์˜ Todo, ๋‚˜์˜ Todo, ์นดํ…Œ๊ณ ๋ฆฌ ๋ณ„ ๊ทœ์น™ ์กฐํšŒ, ์นดํ…Œ๊ณ ๋ฆฌ ์ถ”๊ฐ€,์ˆ˜์ •,์‚ญ์ œ

์Šคํฌ๋ฆฐ์ƒท 2022-07-22 ์˜คํ›„ 4 34 07

์Šคํฌ๋ฆฐ์ƒท 2022-07-22 ์˜คํ›„ 4 34 51

๋ทฐ ๊ตฌ์กฐ

โ”œโ”€โ”€ ๐Ÿ“ฑRules
 ย ย  โ”œโ”€โ”€ ๐Ÿ“ฑRulesTodo
 ย ย  โ”‚ย ย   ย ย  โ”œโ”€โ”€ TodayTodo
 ย ย  โ”‚ย ย   ย ย  โ””โ”€โ”€ MyTodo
 ย ย  โ”œโ”€โ”€ ๐Ÿ“ฑCategory
 ย ย  โ””โ”€โ”€ ๐Ÿ“ฑCategoryEdit
 ย ย   ย ย   ย ย  โ”œโ”€โ”€ Add
 ย ย   ย ย   ย ย  โ””โ”€โ”€ Update

๊ทœ์น™ํƒญ์€ depth๊ฐ€ ๊นŠ์ง€ ์•Š๊ณ  ํ•˜๋‚˜์˜ ๋ทฐ ๋‚ด์—์„œ ๋ชจ๋“  ๊ธฐ๋Šฅ์ด ์กด์žฌํ•˜๊ธฐ ๋•Œ๋ฌธ์—

ํ•˜๋‚˜์˜ ๋ทฐ ๋‚ด์—์„œ SubView๊ฐ€ ์„ธ๊ฐ€์ง€ ๊ฒฝ์šฐ์— ๋”ฐ๋ผ ๋‹ค๋ฅด๊ฒŒ ์กด์žฌํ•˜๊ณ , ๊ทธ SubView ์˜ SubView Case๋ฅผ ๋‚˜๋ˆ„์–ด ๊ตฌํ˜„ํ–ˆ์Šต๋‹ˆ๋‹ค.

๊ตฌํ˜„ ๋ฐฉ์‹

1๏ธโƒฃ ์˜ค๋Š˜์˜ Todo & ๋‚˜์˜ Todo / Category / Category ์ถ”๊ฐ€ ์ˆ˜์ • ์„ธ๊ฐ€์ง€ ๋ทฐ๋กœ ๋‚˜๋ˆ„์–ด ๊ตฌํ˜„ํ–ˆ์Šต๋‹ˆ๋‹ค.

2๏ธโƒฃ ์˜ค๋Š˜์˜ Todo & ๋‚˜์˜ Todo enum์„ ์ •์˜ํ•˜๊ณ  case์— ๋”ฐ๋ผ cell์„ ๋‹ค๋ฅด๊ฒŒ dequeue ํ•ด์ฃผ์—ˆ์Šต๋‹ˆ๋‹ค.

3๏ธโƒฃ Category ์ถ”๊ฐ€ ์ˆ˜์ • ๋˜ํ•œ enum์„ ์ •์˜ํ•˜๊ณ  case์— ๋”ฐ๋ผ ๊ฐ™์€ View๋ฅผ ์žฌ์‚ฌ์šฉํ•˜๋ฉฐ ๋‹ค๋ฅธ ๊ธฐ๋Šฅ์„ ๊ตฌํ˜„ํ–ˆ์Šต๋‹ˆ๋‹ค.


๊น€๋ฏผ์žฌ

๋งก์€๋ทฐ

๋ฉ”์ธํ™ˆํƒญ - ์ด๋ฒคํŠธ, Rules, Todo, ๊ฐ™์€ ๋ฐฉ ํ˜ธ๋ฏธ(homie)๋“ค ์กฐํšŒ, ์ด๋ฒคํŠธ ์ถ”๊ฐ€/์ˆ˜์ •/์‚ญ์ œ ํŒ์—…์ฐฝ, ํ˜ธ๋ฏธํ”„๋กœํ•„ ์กฐํšŒ, ์„ฑํ–ฅํ…Œ์ŠคํŠธ ์กฐํšŒ, ์„ฑํ–ฅ ํ…Œ์ŠคํŠธ ๊ฒฐ๊ณผ ์ถ”๊ฐ€, ํ…Œ์ŠคํŠธ ๊ทธ๋งŒ๋‘๊ธฐ ํŒ์—…

%E1%84%89%E1%85%B3%E1%84%8F%E1%85%B3%E1%84%85%E1%85%B5%E1%86%AB%E1%84%89%E1%85%A3%E1%86%BA%202022-07-22%20%E1%84%8B%E1%85%A9%E1%84%92%E1%85%AE%205 20 56 %E1%84%89%E1%85%B3%E1%84%8F%E1%85%B3%E1%84%85%E1%85%B5%E1%86%AB%E1%84%89%E1%85%A3%E1%86%BA%202022-07-22%20%E1%84%8B%E1%85%A9%E1%84%92%E1%85%AE%205 23 40

%E1%84%89%E1%85%B3%E1%84%8F%E1%85%B3%E1%84%85%E1%85%B5%E1%86%AB%E1%84%89%E1%85%A3%E1%86%BA%202022-07-22%20%E1%84%8B%E1%85%A9%E1%84%92%E1%85%AE%205 22 37

๊ตฌํ˜„ ๋ฐฉ์‹

1๏ธโƒฃ ์ „์ฒด ํ™ˆ ํ™”๋ฉด๋Š” ์ „์ฒด์ ์ธ ๊ตฌ์กฐ๋ฅผ ์ปฌ๋ ‰์…˜๋ทฐ๋กœ ์žก๊ณ  ๊ฐ๊ฐ์˜ ์„น์…˜๊ณผ ์„น์…˜ํ—ค๋”๋ฅผ ํ†ตํ•ด ๋ทฐ๋ฅผ ์„ค๊ณ„ํ•˜์˜€์Šต๋‹ˆ๋‹ค. ๋‘๋ฒˆ์งธ ์…€(KeyRules, Todo) ๊ฐ™์€ ๊ฒฝ์šฐ์— ๋™์ ์œผ๋กœ cell์˜ ๋†’์ด๊ฐ€ ๋ฐ”๋€Œ์–ด์•ผํ–ˆ๊ธฐ์— ๋™์  ๋†’์ด๋ฅผ ์ ์šฉํ•˜์˜€์Šต๋‹ˆ๋‹ค.

2๏ธโƒฃ ์ด๋ฒคํŠธ ํŒ์—…์ฐฝ์„ ๊ตฌ์„ฑํ•  ๋•Œ ์•„์ด์ฝ˜ ๋ผ๋””์˜ค ๋ฒ„ํŠผ๋“ค๊ณผ ๋‚ ์งœ Datepicker๋ถ€๋ถ„์„ ๋ชจ๋‘ View๋กœ ๋นผ๊ณ  TapGesture๋ฅผ ์ ์šฉ์‹œ์ผœ์„œ ๊ตฌํ˜„ํ–ˆ์Šต๋‹ˆ๋‹ค.


์ด์˜์ง„

โšก ๋งก์€ ๋ทฐ

  • Profile Main View โ†’ ํ”„๋กœํ•„ ์ •๋ณด, ์„ฑ๊ฒฉ ์œ ํ˜•๋ณ„ ์ปฌ๋Ÿฌ ์ ์šฉ, ์„ฑํ–ฅ ํ…Œ์ŠคํŠธ ๊ฒฐ๊ณผ ๊ทธ๋ž˜ํ”„ ์• ๋‹ˆ๋ฉ”์ด์…˜ ๊ธฐ๋Šฅ
  • Profile - ์„ฑํ–ฅ ํ…Œ์ŠคํŠธ ๊ฒฐ๊ณผ ๋ทฐ โ†’ ํ”„๋กœํ•„ ์„ฑํ–ฅ ๊ฒฐ๊ณผ์— ๋งž๋Š” ๋ทฐ๋ฅผ ๋ณด์—ฌ์คŒ
  • Profile - Setting ๋ทฐ

1๏ธโƒฃ View Layout ๊ตฌํ˜„ ๋ฐฉ์‹

  • ์ „์ฒด์ ์ธ ๋ ˆ์ด์•„์›ƒ์€ Navigation Bar View Component + CollectionView LayOut์„ ์ด์šฉํ•˜์—ฌ ๊ตฌํ˜„ํ•˜์˜€์Šต๋‹ˆ๋‹ค.
  • Enum ์„ ์ ๊ทน์ ์œผ๋กœ ์ด์šฉ โ†’ Hous- ์˜ ๊ฒฝ์šฐ ๋‹ค์„ฏ ๊ฐ€์ง€ ์„ฑ๊ฒฉ ์œ ํ˜•์ด ์žˆ๊ณ , ๊ฐ ์„ฑ๊ฒฉ๋ณ„๋กœ ์ปฌ๋Ÿฌ, ํ”„๋กœํ•„ ์ด๋ฏธ์ง€ ๋“ฑ์ด ๋Œ€๋ถ€๋ถ„์˜ ๋ทฐ์— ์ผ๊ด„ ์ ์šฉ์ด ๋˜๋Š” ํŠน์„ฑ์„ ๊ฐ€์ง€๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค. โ†’ ์ด ๋‹ค์„ฏ ๊ฐ€์ง€ ํŠน์„ฑ์— ๋Œ€์‘๋˜๋Š” ํ”„๋กœํผํ‹ฐ๋“ค์„ Enum์— ์ •๋ฆฌํ•˜์—ฌ ์ฐจํ›„ ์—…๋ฐ์ดํŠธ ์‹œ Enum๋งŒ ์ˆ˜์ •ํ•ด์ฃผ๋ฉด ๋ชจ๋“  ๋ทฐ์— ์ผ๊ด„ ์ ์šฉ์ด ๊ฐ€๋Šฅํ•˜๊ฒŒ ์„ค๊ณ„๋˜์—ˆ์Šต๋‹ˆ๋‹ค. โ†’ ๋˜ํ•œ ๋‹ค์„ฏ ๊ฐ€์ง€ ํŠน์„ฑ์ด ์ ์šฉ๋˜๋Š” ๋ทฐ์—์„œ ์ผ์ผ์ด Switch ๋ฌธ์„ ์ž‘์„ฑํ•  ํ•„์š”๊ฐ€ ์—†์–ด ์ฝ”๋“œ๊ฐ€ ๋”์šฑ ๊ฐ„๊ฒฐํ•ด์ง‘๋‹ˆ๋‹ค.
  • ๋ ˆ์ด์•„์›ƒ ๊ตฌํ˜„์€ configUI(), render() ํ•จ์ˆ˜๋ฅผ ์ปจ๋ฒค์…˜์œผ๋กœ ํ•˜์—ฌ ๊ณตํ†ต ์ ์šฉํ•˜์—ฌ then, Snapkit ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋ฅผ ํ™œ์šฉํ•ด ๊ตฌํ˜„ํ•˜์˜€์Šต๋‹ˆ๋‹ค.

2๏ธโƒฃ Graph View ๋ฐ Animation ๊ตฌํ˜„ ๋ฐฉ์‹

  • ๊ทธ๋ž˜ํ”„๊ฐ€ ๊ทธ๋ ค์ ธ์•ผ ํ•˜๋Š” ์ ์˜ ์ขŒํ‘œ๋ฅผ ์–ป์–ด๋‚ด๋Š” ๋ถ€๋ถ„๊ณผ ์ ์ด ์ฃผ์–ด์กŒ์„ ๋•Œ ๊ทธ๋ž˜ํ”„๋ฅผ ํ™”๋ฉด์— ํ‘œํ˜„ํ•ด์ฃผ๋Š” ๋ถ€๋ถ„์œผ๋กœ ๋‚˜๋ˆ„์–ด ๊ตฌํ˜„ํ•˜์˜€์Šต๋‹ˆ๋‹ค.
  • ๊ทธ๋ž˜ํ”„ ์ ์˜ ์ขŒํ‘œ๋Š” ์ค‘์‹ฌ์  ๋ฒกํ„ฐ์™€ ๊ทน ์ขŒํ‘œ๊ณ„๋ฅผ ์ด์šฉํ•ด ํ‘œํ˜„ํ•œ ๋ฒกํ„ฐ๋ฅผ ํ•ฉํ•˜๋Š” ๋ฐฉ์‹์œผ๋กœ ์–ป์–ด๋ƒˆ์Šต๋‹ˆ๋‹ค.
  • ์• ๋‹ˆ๋ฉ”์ด์…˜์€ ์• ๋‹ˆ๋ฉ”์ด์…˜ ์‹œ์ž‘ BezierPath์™€ ์• ๋‹ˆ๋ฉ”์ด์…˜ ๋ BezierPath๋ฅผ CAAnimation ์— ease ์˜ต์…˜์„ ์ฃผ์–ด์„œ ์–ป์–ด๋‚ด๋Š” ๋ฐฉ์‹์œผ๋กœ ๊ตฌํ˜„ํ–ˆ์Šต๋‹ˆ๋‹ค.

3๏ธโƒฃ ์„œ๋ฒ„ ์—ฐ๊ฒฐ ๊ตฌํ˜„ ๋ฐฉ์‹

  • ์ง€ํ˜„์ด๊ฐ€ ๊ตฌํ˜„ํ•ด ์ค€ Network Layer๋กœ๋ถ€ํ„ฐ NetworkResponse ๋ฅผ ๊ฐ€์ ธ์˜ต๋‹ˆ๋‹ค.
  • ๋ทฐ์— ์ง์ ‘ ๋ฐ์ดํ„ฐ๋ฅผ ์ ์šฉํ•  ์ˆ˜ ์žˆ๋Š” ๋ฐ์ดํ„ฐ ํฌ๋งท์ธ DataPack ์„ ์ •์˜ํ•ฉ๋‹ˆ๋‹ค.
  • NetworkResponse ํฌ๋งท์„ DataPack ํฌ๋งท์œผ๋กœ ์ „ํ™˜ํ•˜๋Š” ConvertResponseToDataPack ํ•จ์ˆ˜๋ฅผ ๊ตฌํ˜„ํ•ฉ๋‹ˆ๋‹ค.
  • DataPack ์„ ๊ฐ ๋ทฐ์— ์ ์šฉํ•˜๋Š” setData ํ•จ์ˆ˜๋ฅผ ๊ตฌํ˜„ํ•˜์—ฌ ์„œ๋ฒ„ ์—ฐ๊ฒฐ์„ ๋งˆ๋ฌด๋ฆฌํ•ฉ๋‹ˆ๋‹ค.
  • ์œ„์™€ ๊ฐ™์€ ์ผ๊ด€๋œ ํ”Œ๋กœ์šฐ๋กœ ํ†ต์‹  ๋กœ์ง์„ ๊ตฌํ˜„ํ•˜์—ฌ, ์ฐจํ›„ ์—…๋ฐ์ดํŠธ ์‚ฌํ•ญ์ด ์žˆ์„ ๋•Œ ํšจ๊ณผ์ ์œผ๋กœ ๋Œ€์‘ํ•  ์ˆ˜ ์žˆ๋„๋ก ํ•˜์˜€์Šต๋‹ˆ๋‹ค.

๊น€ํ˜ธ์„ธ

์ด๋ฒˆ์— ๋‚ด๊ฐ€ ์•ฑ์žผ์—์„œ ๋งก์€ ๋ถ€๋ถ„์€ ์ปค์Šคํ…€ ํƒญ๋ฐ”์™€ ์ƒˆ๋กœ์šด ๊ทœ์น™์„ ์ˆ˜์ •ํ•˜๊ฑฐ๋‚˜, ์ถ”๊ฐ€ํ•˜๋Š” ๋ทฐ์ด๋‹ค.

1๏ธโƒฃ ์ปค์Šคํ…€ ํƒญ๋ฐ”๋Š” UITabbarController์— ์œ„์— ์กด์žฌํ•˜๋Š” tabbar๋ฅผ ์ˆจ๊น€ ์ฒ˜๋ฆฌํ•˜๊ณ  ์ปค์Šคํ…€ํ•œ Tabbar๋ฅผ ์˜ฌ๋ ธ๊ณ  RxSwift, RxCocoa, RxGestures๋ฅผ ์ด์šฉํ•ด์„œ ์•„์ดํ…œ ๊ฐ„์˜ ์ด๋ฒคํŠธ๋ฅผ ๋ฐœ์ƒ ๋ฐ ๊ตฌ๋… ํ–ˆ๋‹ค.

2๏ธโƒฃ ๊ทœ์น™ ์ถ”๊ฐ€, ์ˆ˜์ •ํ•˜๋Š” ๋ทฐ๋Š” ๋จผ์ € ๋“œ๋ž๋‹ค์šด์ด ๋“ค์–ด๊ฐ€ ์žˆ์–ด์„œ, ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋ฅผ ์“ธ๊นŒ ๋ง๊นŒ ๊ณ ๋ฏผํ•˜๋‹ค๊ฐ€ ์ง์ ‘ ๊ตฌํ˜„ํ•˜๋Š” ๋ฐฉ์‹์œผ๋กœ ๊ฐ”์—ˆ๋Š”๋ฐ ๋“œ๋ž๋‹ค์šด ํƒญ ์ด๋ฒคํŠธ๋ฅผ ์ฃผ๊ธฐ๊ฐ€ ์ข€ ๋ณต์žกํ–ˆ๋‹ค. (์ขŒํ‘œ๊ณ„์‚ฐ์ด ์ข€ ๊นŒ๋‹ค๋กœ์› ์Œ..)


๐Ÿ˜ฒ ์–ด๋ ค์› ๋˜ ์  ๋ฐ ๊ทน๋ณต ๊ณผ์ •


๊น€์ง€ํ˜„

Hous- ๋Š” User ๋งˆ๋‹ค ์„ฑํ–ฅํ…Œ์ŠคํŠธ ๊ฒฐ๊ณผ์— ๋”ฐ๋ฅธ TypeColor๊ฐ€ ์กด์žฌํ•˜๊ณ  ์„œ๋ฒ„์—์„œ String์œผ๋กœ ๋ฐ›์•„์˜ค๊ธฐ ๋•Œ๋ฌธ์— ๋ฐ›์•„์˜จ String์„ ๊ฒฝ์šฐ์— ๋”ฐ๋ผ ๋„ค๊ฐ€์ง€๋กœ ๋ณ€ํ™˜ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.

1. typeColor์— ๋”ฐ๋ฅธ ๋‹ค์–‘ํ•œ ์ƒ‰์˜ ์ง€์ • UIColor
2. typeColor์— ๋”ฐ๋ฅธ ๋‹ค์–‘ํ•œ ์ƒ‰์˜ ๋ฐฐ๊ฒฝ UIColor
3. typeColor์— ๋”ฐ๋ฅธ ๋‹ค์–‘ํ•œ ์ƒ‰์˜ ์–ผ๊ตด ์ด๋ชจ์ง€
4. typeColor์— ๋”ฐ๋ฅธ ๋‹ค์–‘ํ•œ ์ƒ‰์˜ ์ฒดํฌ๋œ ์–ผ๊ตด ์ด๋ชจ์ง€

ํ•˜์ง€๋งŒ ์„œ๋ฒ„ํ†ต์‹ ์„ ํ•  ๋•Œ๋งˆ๋‹ค ์กฐ๊ฑด๋ฌธ์„ ์‚ฌ์šฉํ•˜์—ฌ TypeColor์— ๋”ฐ๋ฅธ ๋ถ„๊ธฐ์ฒ˜๋ฆฌ๋ฅผ ํ–ˆ๋”๋‹ˆ ์ค‘๋ณต ์ฝ”๋“œ๊ฐ€ ๊ต‰์žฅํžˆ ๋งŽ์•„์กŒ์Šต๋‹ˆ๋‹ค.

์ด ๋ถ€๋ถ„์„ Factory Pattern ์œผ๋กœ ๊ฐ์ฒด ์ƒ์„ฑ์„ ์บก์Šํ™” ํ•˜์˜€์Šต๋‹ˆ๋‹ค.

enum AssigneeColor: String {
  case yellow, blue, purple, red, green, gray, none
}

protocol AssigneeProtocol {
  var checkedFaceImage: UIImage { get set }
  var faceImage: UIImage { get set }
  var color: UIColor { get set }
  var profileBackgroundColor: UIColor { get set }
}

struct YellowAssignee: AssigneeProtocol {
  var checkedFaceImage = R.Image.faceCheckedYellow
  var faceImage = R.Image.faceYellow
  var color = R.Color.paleGold
  var profileBackgroundColor = R.Color.offWhite
}

// ์ƒ๋žต

struct AssigneeFactory {
  
  static func makeAssignee(type: AssigneeColor) -> AssigneeProtocol {
    switch type {
    case .yellow:
      return YellowAssignee()
		//์ƒ๋žต
    }
  }
}

๋‹ค์Œ๊ณผ ๊ฐ™์ด ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

let assignee = AssigneeFactory.makeAssignee(type: AssigneeColor(rawValue: data.typeColor.lowercased()))

participantButton.setBackgroundImage(assignee.faceImage, for: .normal)
participantButton.setBackgroundImage(assignee.checkedFaceImage, for: .selected)

๊น€๋ฏผ์žฌ

์–ด๋ ค์› ๋˜ ์  ๋ฐ ๊ทน๋ณต ๊ณผ์ •

1๏ธโƒฃ git rebase๋ฅผ ์ฒ˜์Œ ์ ‘ํ•˜๋ฉด์„œ ์ฝ”๋“œ๋‚˜ ํŒŒ์ผ๊ตฌ์กฐ git conflict๋“ฑ์„ ๋ฌด์ˆ˜ํžˆ ๊ฒช์œผ๋ฉฐ resetํ•˜๋ฉฐ rebase๋ฅผ ์ตํžˆ๊ณ  git์— ๋Œ€ํ•œ ๋‘๋ ค์›€์„ ์–ด๋Š์ •๋„ ๋–จ์ณ๋‚ผ ์ˆ˜ ์žˆ์—ˆ๋‹ค.

2๏ธโƒฃ ์ดˆ๊ธฐ์— GET APIํ†ต์‹ ์„ viewWillAppear์— ๋„ฃ์–ด์คฌ์œผ๋‚˜ dismiss์‹œ์—๋Š” viewWillAppear๊ฐ€ ํ˜ธ์ถœ๋˜์ง€ ์•Š์•„ ์˜ˆ์ƒํ•œ ๊ฒฐ๊ณผ๊ฐ’์„ ์–ป์ง€ ๋ชปํ–ˆ๋‹ค. iOS 13์ดํ›„๋กœ dismissํ›„์—๋Š” viewWillAppear๊ฐ€ ํ˜ธ์ถœ๋˜์ง€ ์•Š๋Š”๋‹ค ํ•˜์—ฌ NotificationCenter๋ฅผ ํ™œ์šฉํ•ด์„œ ์ด๋ฒคํŠธ๋ฅผ ๊ฐ์ง€ํ•˜๊ณ  ์›ํ•˜๋Š” CollectionView๋ฅผ ํŒ์—…์„ dismissํ•œ ํ›„์— reload์‹œ์ผœ์ค„ ์ˆ˜ ์žˆ์—ˆ๋‹ค.

3๏ธโƒฃ ํ…์ŠคํŠธํ•„๋“œ ๊ธ€์ž์ˆ˜๋ฅผ ์ œํ•œํ•  ํ•„์š”๊ฐ€ ์žˆ์—ˆ๋Š”๋ฐ textFieldDelegate๋กœ๋งŒ ๊ธ€์ž์ˆ˜๋ฅผ ์ œํ•œ์„ ํ•˜๋ฉด ํ•œ๊ธ€์˜ ๋ฐ›์นจ ํŠน์„ฑ ๋•Œ๋ฌธ์— ๊ธ€์ž์ˆ˜๊ฐ€ ์ž˜ ๋งž์ง€ ์•Š๋Š” ์ด์Šˆ๊ฐ€ ์žˆ์–ด textDidChangeNotification์˜ NoficationCenter๋ฅผ ์ด์šฉํ•ด์„œ ํ•œ๋ฒˆ๋” ์ฒ˜๋ฆฌ๋ฅผ ํ•ด์ฃผ์–ด์„œ ํ•œ๊ธ€ ๊ธ€์ž์ˆ˜ ์ œํ•œ์„ ๊ตฌํ˜„ํ•  ์ˆ˜ ์žˆ์—ˆ๋‹ค.

4๏ธโƒฃ ์„ฑํ–ฅํ…Œ์ŠคํŠธ๋ฅผ ํ•  ์‹œ์— ํ…Œ์ŠคํŠธ๋ฅผ ํ•œ ๋ฒ„ํŠผ์˜ ์ƒํƒœ๋ฅผ ๊ณ„์† ๊ธฐ์–ตํ•˜๊ณ  ์žˆ๊ณ  ๋Œ์•„๊ฐ€๋ฉด ์ด๋ฅผ ์ˆ˜์ •ํ•  ์ˆ˜ ์žˆ์–ด์•ผํ–ˆ๊ธฐ ๋•Œ๋ฌธ์— DTO๋ฅผ ๋ฐ”๋กœ ๋ฐ›์•„์„œ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ์ด ์•„๋‹Œ dictionary๋ฅผ ์ด์šฉํ•ด์„œ ํ•œ๋ฒˆ์˜ ๋‹ค๋ฅธ struct์œผ๋กœ ๋งŒ๋“  ํ›„ ์ด๋ฅผ ์ ์šฉํ•ด์„œ ๊ตฌํ˜„ํ–ˆ์Šต๋‹ˆ๋‹ค.

struct TypeTestDTO: Codable {
  let id: String
  let question: String
  let testNum: Int
  let questionImg: String
  let answers: [String]
  let questionType: String
  
  enum CodingKeys: String, CodingKey {
    case id = "_id"
    case question
    case testNum
    case questionImg
    case answers
    case questionType
  }
}
struct TestCellItem {
  let testTitle: String
  let testIdx: Int
  let testImg: String
  let testType: String
  var testAnswers: [ButtonState]
  
  init(dto: TypeTestDTO) {
    self.testTitle = dto.question
    self.testIdx = dto.testNum
    self.testImg = dto.questionImg
    self.testType = dto.questionType
    
    var t: [ButtonState] = []
    for answer in dto.answers {
      let button = ButtonState(optionText: answer, isSelected: false)
      t.append(button)
    }
    self.testAnswers = t
  }
}

DTO๋ฅผ ํ•œ๋ฒˆ ๋” ๊ฐ์‹ผ custom struct DTO


์ด์˜์ง„

๐Ÿ‘‰ ํ”„๋กœ์ ํŠธ ์ง„ํ–‰ ๊ฐ„ ์–ด๋ ค์› ๋˜ ์ ๊ณผ ํ•ด๊ฒฐ ๊ณผ์ •


๊น€ํ˜ธ์„ธ

1๏ธโƒฃ ํ•˜์šฐ์Šค ํ”„๋กœ์ ํŠธ๋ฅผ ์ง„ํ–‰ํ•˜๋ฉด์„œ ์–ด๋ ค์› ๋˜ ๋ถ€๋ถ„์€ ์ƒˆ๋กœ์šด ๊ทœ์น™์„ ์ถ”๊ฐ€ํ•  ๋•Œ, ์œ ์ € ์ธํ„ฐ๋ ‰์…˜์— ๋”ฐ๋ผ ๋ณ€ํ•˜๋Š” UI ๋กœ์ง ์ฒ˜๋ฆฌ์˜€๋‹ค. ํ•ด๊ฒฐ์€ Dictionary๋ฅผ ์ด์šฉํ•ด์„œ ์ธํ„ฐ๋ ‰์…˜๋งˆ๋‹ค ์—…๋ฐ์ดํŠธ๋ฅผ ํ•˜๋Š” ๋ฐฉ์‹์œผ๋กœ ํ–ˆ๋‹ค.

2๏ธโƒฃ ๊ฐœ๋ฐœ์ด๋ผ๋Š” ๊ฒƒ ํŠน์„ฑ์ƒ ํ˜‘์—…ํ•  ํ™•๋ฅ ์ด ๋†’์€๋ฐ Git์— ๋Œ€ํ•ด์„œ ์ข€ ๋” ์ž์„ธํžˆ ์•Œ ํ•„์š”๊ฐ€ ์žˆ๋‹ค๊ณ  ์ƒ๊ฐํ•ด์„œ( ์‚ฌ์‹ค ๊ทธ๋ƒฅ One-line์ด ์˜ˆ๋ป์„œ ) git rebase merge + git flow๋ฅผ ๋„์ž…ํ•ด๋ดค๋‹ค. rebase๋ฅผ ํ•˜๊ฒŒ ๋˜๋ฉด merge ๋ณด๋‹ค ํ›จ์”ฌ ์ถฉ๋Œ์ด ๋งŽ์ด ๋ฐœ์ƒํ•˜๋Š”๋ฐ ์ดˆ๊ธฐ์—๋Š” ํŒ€์›๋“ค์ด ์ด๊ฒƒ์— ๋Œ€ํ•ด์„œ ๊ฑฑ์ •ํ–ˆ์—ˆ๋‹ค. ์ง€๊ธˆ ์ด ๊ธ€์„ ์“ฐ๋Š” ์‹œ์ ์—์„œ ๋‹ค๋“ค git rebase์— ๋Œ€ํ•ด ํฐ ๋ถ€๋‹ด๊ฐ์„ ๊ฐ€์ง€์ง€ ์•Š๊ณ  ์ถฉ๋Œ์— ๋” ์—ฌ์œ ๋กœ์›Œ์ง„ ๋ชจ์Šต์„ ๋ด์„œ ๋‚˜๋ฆ„ ๋ฟŒ๋“ฏํ–ˆ๋‹ค.

3๏ธโƒฃ ๋˜ํ•œ Injection์„ ๋„์ž…ํ•ด๋ดค๋Š”๋ฐ ๊ฐœ์ธ์ ์œผ๋กœ๋„ ๋‚˜๋ฆ„ ์œ ์šฉํ•˜๊ฒŒ ์‚ฌ์šฉํ•˜๊ณ  ์žˆ๊ธฐ๋„ ํ•˜๊ณ  ํŒ€์›๋“ค์ด ๋งˆ์Œ์— ๋“ค์–ดํ•˜๋Š” ๊ฑฐ ๊ฐ™์•„์„œ ์ข‹์•˜๋‹ค. ๋‹ค๋งŒ ๋ณดํ†ต ์‚ฌ์šฉํ•  ๋•Œ๋Š”, Test App Target์„ ๋งŒ๋“ค๊ณ  ์ž‘์—…์„ ํ•˜๋Š”๋ฐ ์ข€๋งŒ ๋” ์‹ ๊ฒฝ ์จ์„œ, ๊ทธ ๋ถ€๋ถ„๋„ ๋„์ž…ํ–ˆ์œผ๋ฉด ์ข‹์ง€ ์•Š์•˜์„๊นŒ ํ•˜๋Š” ์•„์‰ฌ์›€์ด ๋“ค์—ˆ๋‹ค.


About

๐Ÿก ํ•œ์ง‘์‚ด์ด ๊ฐ€๋ณด์ž๊ณ  แ••( แ› )แ•— ๐Ÿก

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages