Skip to content
This repository was archived by the owner on Jan 6, 2024. It is now read-only.

[Refactor] ViewController์„ ์œ„ํ•œ ๊ธฐ๋ณธ Protocol ์ƒ์„ฑย #34

@ChoiysApple

Description

@ChoiysApple

๊ธฐ๋Šฅ ์„ค๋ช…

UIViewController์˜ ๊ธฐ๋ณธ ์„ค์ • ์ฝ”๋“œ๋ฅผ Protocol์„ ์ด์šฉํ•ด ์ •๋ฆฌ & ์ฝ”๋”ฉ ์ปจ๋ฒค์…˜์„ ์ค€์ˆ˜ํ•˜๋„๋ก ํ•œ๋‹ค

ํ˜„์žฌ ๋™์ž‘

UIViewController ์ฝ”๋“œ์—์„œ ์ดˆ๊ธฐ ์„ค์ • ์ฝ”๋“œ๋“ค์„ ํ˜„์žฌ๋Š” configureUI()์— constraint ์„ค์ • ์ฝ”๋“œ๋ฅผ ๋„ฃ๊ณ  viewDidLoad()์— ์ดˆ๊ธฐ ์„ค์ •์ฝ”๋“œ(.backgroundColor, tableView.delegate = self ๋“ฑ)์„ ๊ฐ™์ด ๋„ฃ๋Š” ๋ฐฉ์‹

๊ธฐ๋Œ€ ๋™์ž‘

setUpView(), configureUI() ํ•จ์ˆ˜๋ฅผ ๊ฐ€์ง€๋Š” ํ”„๋กœํ† ์ฝœ์„ ๋ชจ๋“  UIViewController์—์„œ ์ฑ„ํƒํ•˜๊ฒŒ ํ•œ๋‹ค

protocol WViewController {
    func setUpView()
    func configureUI()
    func bindViewModel()
}
  1. setUpView() - tableView.delegate = self ๊ฐ™์€ ๋ทฐ์ปจํŠธ๋กค๋Ÿฌ ์ž์ฒด์— ๊ด€ํ•œ ์„ค์ •
  2. configureUI() - addSubView()์™€ makeConstraints()3.
  3. bindViewModel() - ๋ฐ์ดํ„ฐ ๋ฐ”์ธ๋”ฉ

setUpView ํ•จ์ˆ˜๋ช…์€ ์˜ˆ์‹œ์ž…๋‹ˆ๋‹ค

configureUI ํ•จ์ˆ˜๋ช…์€ ํ˜„์žฌ๋„ ์‚ฌ์šฉ์ค‘์ด๋ฏ€๋กœ ๊ทธ๋Œ€๋กœ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions