[Bible] step2 : UIColor Extension & MVC #4
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
스텝별 작업목록
학습키워드
TableView, Section, TableViewCell, Xib
고민과 해결
Cell
Section
MVC 패턴 적용 (step2 반영 예정) -> 반영 완료
공통 코드 분리 (step2 반영 예정) -> 반영 완료
규모가 큰 프로젝트가 아니라 따로 뺄 코드가 많은 건 아니지만, UIColor 코드가 길게 여러 개 있는 것이 썩 깔끔해보이지 않아서 색상 코드를 따로 정의해두는 파일을 만들어야 될 것 같습니다.
다음 프로젝트 진행 때는 이렇게 프로젝트 전반적으로 사용하는 코드들은 미리 빼두는 습관을 들여야겠습니다.
(반영 내용) 앱 내에서 자주 사용하는 코드들을 모아놓는 방법은 여러가지가 있는데 이번에는 색상 하나를 추가하는 것이라 UIColor에 Extension을 추가하는 방법을 선택했습니다. 레퍼런스도 이렇게 했더라구요.
처음 GPT에게 방식을 물어봤을 때 파일명을 "UIColor+CustomColors.swift", "UIColor+Custom.swift", "UIColor+Extensions.swift"와 같은 네이밍을 사용할 수 있다고 하더라구요. Objective-C에서는 Extension과 비슷한 카테고리라는 개념을 사용했는데 이 때 "클래스명+카테고리명" 형식으로 네이밍했던게 그대로 이어진 것 같습니다. 새로운 걸 알아갑니다😀