-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[team-01][쑤, Isaac] ViewModel 구조화, 첫 번째 화면 구성 #13
Conversation
Image를 받아오는 흐름이 브랜치를 합치는 과정에서 유실된 것 같아 코드 추가 후 푸시드립니다 😅 |
import Foundation | ||
|
||
struct SidedishOfCategory: Codable { | ||
var statusCode: Int |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
statusCode를 사용하시지 않는데 프로퍼티로 작성하신 이유가 있을까요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
statusCode를 내부 로직에서 사용하고 있지는 않으나, 위와 마찬가지로 API 응답 형태에 따라 decoding 하기 위해 작성했던 값입니다!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
statusCode를 저장하지 않고도 가능한 작업이지 않나요?
} | ||
|
||
func downloadImage(from url: URL, completion: @escaping ((Data) -> ()) ) { | ||
URLSession.shared.dataTask(with: url) { (data, response, error) in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
사용하지 않는 값은 _으로 주석 처리해주시면 다른 사람이 코드를 읽는데 많은 도움이 됩니다.
- CustomStringConvertible 활용 - NSLog 고려 - tapGestureRecognize convenience init 사용 - delegate, dataSource storyboard에서 설정
추가로 궁금한 부분은 제외하고 말씀주신 피드백 반영해서 push 완료했습니다! |
- DEBUG시 error 출력 - badge label init 시 radius 설정 - section이 아닌 cell 별로 reload
- imageData 프로퍼티 추가, 필요없는 속성 제거 - 각 부분 protocol 채택 - Networking 제거 - Gesture 서브클래싱 제거 후 핸들러 설정
오전에 피드백 주신 내용 수정 완료했습니다! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@okstring @lenaios
피알을 수정하기 앞써 이번에 작성한 코맨트는 무시하시고 프로젝트를 진행하셔도 좋습니다.
더 이상 고칠게 없다고 판단하시면 스쿼시 머지로 부탁드리겠습니다.
코드를 보개되면 특정 부분에선 다음 줄을 공백으로 두고 넘어가거나 어떤 부분은 띄웠고 어떤 부분은 붙이는 식으로 코드가 작성되어있습니다.
현업에서 모든 코드가 하나의 컨밴션을 준수하는 건 아니지만 개인적으로 협업에 있어서 중요한 부분이라고 생각합니다. 앞으로 코드를 작성할 때 두분이서 의논하셔서 코드 컨밴션을 맞춰주셨으면 좋겠습니다.
클린 아키텍처를 반영하는게 많이 어려우셨을 텐데 다들 고생하셨습니다 :)
case launch = "론칭특가" | ||
|
||
var description: String { | ||
return self.rawValue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rawValue를 사용하시는 것보다
description 내부에서 switch문으로 분류하는 게 더 안전해보입니다.
|
||
struct SidedishItem: Codable { | ||
var detailHash: String | ||
var image: String |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
image 타입이 string인데 뜻하는게 url에 더 가깝지 않을까요?
|
||
class SidedishNetworkCenter: Networkable { | ||
func fetchItems(url: String, completion: @escaping (Result<[SidedishItem], AFError>) -> ()) { | ||
//MARK: - cache가 없으면 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
주석은 정말 필요로할 때 보통 사용합니다.
ex) iOS 14.0 부턴 api가 변경됨으로, 최소 버전이 14.0일 때 개선해주세요.
메소드 네이밍이 정말 어려운 문제지만 해당 메소드가 무슨일을 하는지 표현하는 방법도 연습하셨으면 좋겠습니다.
|
||
import UIKit | ||
|
||
class TapToastGestureRecognize: UITapGestureRecognizer { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
코드를 변경한 지금 TapToastGestureRecognize가 필요한가요?
return ItemCollectionViewCell() | ||
} | ||
let item = self.itemViewModel.items[indexPath.row] | ||
let priceString = item.nPrice == nil ? "" : "\(item.nPrice ?? "")원" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
data + "원" 이런 형태의 모든 부분에 뷰에서 작업하는 것보다 viewModel에서 만들어주고 뷰에선 할당만 하는 형식이 어떤가요? 라고 말씀드렸던 겁니다.
Feature/메인 화면 UI 구성 (#8)
- 변수 네이밍 변경 - 불필요한 주석, 파일 제거 - data + "원" 형태 처리를 viewModel에서 하도록 수정
* [#1] init: 🎉 개발 환경 구축 * [#3] feat: ✨ Header 만들기 * [#5] feat: ✨ BestTab UI 구현 - BestTab UI - 상수 파일 - const.js - 재사용 컴포넌트 - Label.jsx - ItemCard.jsx * [#7] feat: ✨ Slide UI 구현 - App.jsx - SlideContainer import - BestItem.jsx - 삭제 (미사용) - BestItems.jsx - ItemCard prop 추가 - BestTab.jsx - 스타일 수정 - SlideContainer.jsx - UI 구현 - SlideItems.jsx - UI 구현 - SlideArrowBtn.jsx - UI 구현 - ItemCard.jsx - 스타일 수정 - prop 추가 - Label.jsx - prop 추가 - 기본 값 추가 * [#8] feat: ✨ ShowMoreBtn UI 구현 - App.js - ShowMoreBtn import - ShowMoreBtn.jsx - UI 구현 * [#10] feat: ✨ Header Dropdown 구현 - App.js - Header 경로 수정 - Header.jsx - 경로 변경 - HeaderLeft & Right 분리 - HeaderLeft.jsx - 컴포넌트화 - Navigations 컴포넌트화 - HeaderRight.jsx - 컴포넌트화 - Navigations.jsx - 컴포넌트화 - Dropdown 구현 * [#13] feat: ✨ API에 fetch 요청 로직 구현 * [#13] feat: ✨ API 요청, 베스트 기능구현 - BestItems.jsx - API 데이터 동기화 - BestTab.jsx - useState, useEffect, API 요청 - BestTabContainer.jsx - API 데이터 동기화 - BestTabNavigator.jsx - API 데이터 동기화 - ItemCard.jsx - prop 변경 - Label.jsx - COLOR변수 추가 * [#15] feat: ✨ 상세 modal 페이지 UI 구현 - App.js - PopUpContainer import - PopUpContainer.jsx - UI 구현 - PopUpImages.jsx - UI 구현 - PopUpInformations.jsx - UI 구현 Co-authored-by: kowoohyuk <kowoohyuk91@gmail.com>
* [#1] feat : create CRA - CRA를 설치했습니다 * [#1] feat : mediumCard index.jsx prop 추가 - 상동 * [#1] feat : node-sass 추가 - node sass를 추가했습니다 * [#1] feat : 폴더 구조 정리 - atoms, molecules, images 등 파일 구조 수정했습니다 * [#5] feat : reset scss 추가 - reset scss 추가 - 기본 글꼴 추가 * [#5] feat : button, icon, tag components 추가 - atoms의 button, icon, tag component를 재사용 가능한 형태로 생성했습니다. * [#5] feat: set moculses structure - LargeCard 구조설정 - MediumCard 구조 설정 * [#5] chore : 잘못 생성된 파일 수정 - 파일 명을 sidedish -> frontend로 바꾸는 과정에서 폴더 구성이 꼬여서 수정 * [#5] feat: molcules- LargeCard,MediumCard 구조 생성 * [#13] feat : MainDish, More 컴포넌트 생성 - 신규 컴포넌트 생성: maindish, more organisms * [#11] feat: fetch를 위한 util dir 생성 - util/loadData 생성 : fetch로 data가져오기 - util/url 생성: 기본 url주소 변수 설정 * [#11] feat: HeaderLeft 생성 * [#13] feat : MediumCard TagType 추가 - 메인요리에 medium카드를 사용하기 위해 medium카드 일부 속성을 수정했습니다. * [#13] feat : useFetch 컴포넌트 추가 - fetch기능을 분리하기 위해 util-useFetch컴포넌트를 생성 * [#11] feat: Header 생성 - HeaderLeft 구조 생성 - HeaderRight 구조 생성 - BestDish 구조 생성 중 * [#11] feat: useFatch fetch오류 해결 * [#12] feat: BestDish useTabs hook 사용 * [#13] feat : 카드 캐로셀 기능 완성 - setTimeout으로 렌더링을 지연시켜 캐로셀 기능을 완성 * [#12] feat: BestDish UI 및 기능구성 - Tab 버튼 클릭시 rendering - Header Style 일부 수정 (HeaderRight,HeaderLeft,Span,Icon) * [#13] feat: CSS style 수정 - innerTitle 설정 * [#13] feat: MainDish,SideDish,BestDish CSS style디테일 설정 - mainDish의 <Icon>,<Image> margin 설정 * [#13] fix : tag 버튼 오류, carousel 렌더링 지연 방식 변경 - tag 가 이벤트 특가만 나타나는 오류 수정 - carousel 렌더링 지연 방식을 setTimeOut -> onTransitionEnd 로 변경 Co-authored-by: ink-0 <71919983+ink-0@users.noreply.github.com>
item 컨트롤러 생성해 기본적인 API 생성
섹션별로 업데이트를 하기위해 UICollectionViewDiffableDataSource를 도입하였습니다. 이에 따른 NSDiffableDataSourceSnapshot을 적용해 주었고 가독성을 높이기 위해 typealias를 통하여 재정의 해주었습니다. DataSource에 정보를 주기 위한 BanchanListViewModel을 정의해주었습니다. issue: #13
refactor: Create FetchDataUseCase to modify architecture
* [#1] feat : create CRA - CRA를 설치했습니다 * [#1] feat : mediumCard index.jsx prop 추가 - 상동 * [#1] feat : node-sass 추가 - node sass를 추가했습니다 * [#1] feat : 폴더 구조 정리 - atoms, molecules, images 등 파일 구조 수정했습니다 * [#5] feat : reset scss 추가 - reset scss 추가 - 기본 글꼴 추가 * [#5] feat : button, icon, tag components 추가 - atoms의 button, icon, tag component를 재사용 가능한 형태로 생성했습니다. * [#5] feat: set moculses structure - LargeCard 구조설정 - MediumCard 구조 설정 * [#5] chore : 잘못 생성된 파일 수정 - 파일 명을 sidedish -> frontend로 바꾸는 과정에서 폴더 구성이 꼬여서 수정 * [#5] feat: molcules- LargeCard,MediumCard 구조 생성 * [#13] feat : MainDish, More 컴포넌트 생성 - 신규 컴포넌트 생성: maindish, more organisms * [#11] feat: fetch를 위한 util dir 생성 - util/loadData 생성 : fetch로 data가져오기 - util/url 생성: 기본 url주소 변수 설정 * [#11] feat: HeaderLeft 생성 * [#13] feat : MediumCard TagType 추가 - 메인요리에 medium카드를 사용하기 위해 medium카드 일부 속성을 수정했습니다. * [#13] feat : useFetch 컴포넌트 추가 - fetch기능을 분리하기 위해 util-useFetch컴포넌트를 생성 * [#11] feat: Header 생성 - HeaderLeft 구조 생성 - HeaderRight 구조 생성 - BestDish 구조 생성 중 * [#11] feat: useFatch fetch오류 해결 * [#12] feat: BestDish useTabs hook 사용 * [#13] feat : 카드 캐로셀 기능 완성 - setTimeout으로 렌더링을 지연시켜 캐로셀 기능을 완성 * [#12] feat: BestDish UI 및 기능구성 - Tab 버튼 클릭시 rendering - Header Style 일부 수정 (HeaderRight,HeaderLeft,Span,Icon) * deploy : build 210423 * [#13] feat: CSS style 수정 - innerTitle 설정 * chore: add gitginore * chore: Add basic gradlew files * [#13] feat: MainDish,SideDish,BestDish CSS style디테일 설정 - mainDish의 <Icon>,<Image> margin 설정 * [#13] fix : tag 버튼 오류, carousel 렌더링 지연 방식 변경 - tag 가 이벤트 특가만 나타나는 오류 수정 - carousel 렌더링 지연 방식을 setTimeOut -> onTransitionEnd 로 변경 * deploy : build 210424 * [#25] feat : Detail UI 컴포넌트 생성 - Detail UI 를 위한 InfoGeneral, InfoImages, InfoNumber, InfoPrice, InfoProduct molecules 컴포넌트 생성 * [#24] feat: ADD tab click event(color change) - Fix MediumCard Tag 부분 * [#25] fix : icon onClick 이벤트 실행 로직 수정 - icon이 left, right 일 경우에만 moveSlide이벤트가 실행되도록 수정 * [#24] feat: ADD Img MouseOver event - useState를 통한 isHover로 상태변경 가능 * [#24] feat: Fix CSS Detail in HoverEvent * deploy : build 210427 * [#24] feat: ADD HeaderDrop event - Header MouseOver 시 Drop event 추가 - Header DropMenu MouseOver 시 hover event 추가 - Private Component 이름 통일변경 (ex Div -> WrapDiv) - Component들의 inex.style.jsx 추가 (Styled div 분리) * [#25] fix : MainDish Carousel 스타일 적용 함수 분리 - MainDish 스타일 및 매직넘버 삭제 * [#37] refactor : 코드리뷰 반영 - useFatch 구조 변경 : loadData 컴포넌트 생성해서 데이터만 받아오고 useEffect는 각 컴포넌트에서 실행 - tag 내용 및 컨텐츠 적용 방식 수정 - span 스타일 컴포넌트 적용방식을 className 사용으로 변경 * [#25] feat : Detail UI 컴포넌트 수정 - pages 컴포넌트 생성 * [#25] feat : Modal 컴포넌트 생성 - 모달 컴포넌트 생성 및 클릭 후 모달 오픈, close 버튼 클릭시 숨김 기능 구현 * [#25] feat: Modal data fetch 연결 * deploy : build 210428 * deploy : rebuild 210428 * deploy : rebuild 210428 * deploy : rebuild 210428 * build : rebuild 210428 * [#26] feat : 상세페이지 내 이미지 이벤트 추가 - 이미지 및 썸네일 추가 - 썸네일 클릭 시 메인 이미지 변경 이벤트 추가 * [#26] feat : large 카드에 모달 이벤트 추가 - large 카드에도 모달 이벤트를 추가했으나, 아직 베스트 반찬에는 데이터 api를 못받아오고 있으므로 실행은 되지 않게끔 주석처리 했습니다 * [#27] feat: Detail - Info UI 생성 및 fetch data 연결 * deploy :build 210429 * [#27] feat: Fix syntax error * build : build 210429 * [#26] refactor : carousel 컴포넌트 생성 - 라이브러리화를 위해 carousel 컴포넌트 생성 * build : rebuild 210429 * build : rebuild 210429 * [#26] refactor : carousel 컴포넌트 완성 carousel, carousel style 컴포넌트를 mainDish 컴포넌트에서 분리 완료 * [#26] feat : OtherCard, DetailOther 컴포넌트 생성 - 디테일 Carousel 작업을 위해 상기 컴포넌트 생성 * [#27] feat: Datail CSS UI 수정 - UI: BestMenu 오른쪽마진 수정 - UI: HoverCard 가운데 정렬 수정 - UI: Mouse cursor 디테일 설정 - feat: useTabs 삭제 및 component내부로 수정 - faet: getComma 파일생성 ( 원, (,) 넣는 함수) * deploy : rebuild 210429 * deploy : build 210430 * [#27] FE API data fetch 연결 확인 * [#45] FE API data fetch 연결 확인 * [#26] feat : OtherCard 스타일 적용 완성 - Other Card의 레이아웃 완성 * [#26] feat : OtherCard 케로셀 적용 중 * [#45] feat: 디테일한 CSS UI 구성 * [#26] feat : OtherCard 케로셀 완료 - portal을 적용해서 기존 캐러셀 컴포넌트를 재활용할 수 없는 관계로 캐로셀을 중복해서 사용함 * [#45] feat: fetch Data API and 합치기 * [#45]feat: Details 파일명 변경 및 데이터 전달 * [#45] feat:Details close error 해결 * [#45]feat: CSS style 수정 * [#45] feat: Image data 수정 * fix : Change directory name to camel case Co-authored-by: ink-0 <71919983+ink-0@users.noreply.github.com> Co-authored-by: woody <woojihye2339@gmail.com> Co-authored-by: Tree <gmldbs1109@naver.com> Co-authored-by: Ubuntu <ubuntu@ip-172-31-44-162.ap-northeast-2.compute.internal>
* [#1] init: 🎉 개발 환경 구축 * [#3] feat: ✨ Header 만들기 * [#5] feat: ✨ BestTab UI 구현 - BestTab UI - 상수 파일 - const.js - 재사용 컴포넌트 - Label.jsx - ItemCard.jsx * [#7] feat: ✨ Slide UI 구현 - App.jsx - SlideContainer import - BestItem.jsx - 삭제 (미사용) - BestItems.jsx - ItemCard prop 추가 - BestTab.jsx - 스타일 수정 - SlideContainer.jsx - UI 구현 - SlideItems.jsx - UI 구현 - SlideArrowBtn.jsx - UI 구현 - ItemCard.jsx - 스타일 수정 - prop 추가 - Label.jsx - prop 추가 - 기본 값 추가 * [#8] feat: ✨ ShowMoreBtn UI 구현 - App.js - ShowMoreBtn import - ShowMoreBtn.jsx - UI 구현 * [#10] feat: ✨ Header Dropdown 구현 - App.js - Header 경로 수정 - Header.jsx - 경로 변경 - HeaderLeft & Right 분리 - HeaderLeft.jsx - 컴포넌트화 - Navigations 컴포넌트화 - HeaderRight.jsx - 컴포넌트화 - Navigations.jsx - 컴포넌트화 - Dropdown 구현 * [#13] feat: ✨ API에 fetch 요청 로직 구현 * [#13] feat: ✨ API 요청, 베스트 기능구현 - BestItems.jsx - API 데이터 동기화 - BestTab.jsx - useState, useEffect, API 요청 - BestTabContainer.jsx - API 데이터 동기화 - BestTabNavigator.jsx - API 데이터 동기화 - ItemCard.jsx - prop 변경 - Label.jsx - COLOR변수 추가 * [#15] feat: ✨ 상세 modal 페이지 UI 구현 - App.js - PopUpContainer import - PopUpContainer.jsx - UI 구현 - PopUpImages.jsx - UI 구현 - PopUpInformations.jsx - UI 구현 * [#16] feat: ✨ 모달 페이지 이벤트 구현중 * [#16] feat: ✨ 수량정보 컴포넌트 분리 * [#19] refactor: 🔨 리팩토링, 부족한 부분 추가 구현 - 파일 및 폴더 구조 변경 - common 폴더 생성 - Context.jsx - useContext 사용하여 prop drilling 개선 - 팝업 이벤트 구현 - 수량 변경 - 주문하기 - 주문결과 안내 메시지 UI * [#19] refactor: 🔨 리팩토링 * [#17] feat: ✨ dj-slider 폴더구조 구축 * [#17] feat: ✨ 슬라이드 1/2 구현 중 * [#23] refactor: 🔨 코드 리뷰 코멘트 반영 및 개선 * [#17] feat: ✨ 슬라이드 구현중/일부사항 수정 - util.js - price에 comma 붙이는 기능 구현 - PopUpItemCountContainer.jsx - price에 comma 붙이는 기능 import - ItemCard.jsx - price에 comma 붙이는 기능 import - 이미지 background로 수정 - Label.jsx - 라벨 배경색상 적용 * [#17] feat: ✨ 슬라이드 구현중 - 모듈화 - 시연을 위한 기능 구현을 위해 보류 * [#25] feat: ✨ 슬라이드 2/2 구현, API 데이터 동기화 - 슬라이드 명칭을 캐로셀로 변경 - API 데이터 동기화 - 캐로셀의 ItemCard를 children으로 변경 - 모듈화를 위함! - 아이템카드 mini, large 프로퍼티 추가 - 상세모달 캐로셀 추가 - 상세모달 스크롤 추가 - 모든 카테고리 보기 기능 구현 * [#27] feat: ✨ BestTab Skeleton UI 만들기 - Main.jsx - 시연을 위한 loop 설정 추가 - BestTab.jsx - SkeletonTab import - BestTabNavigator.jsx - 주석 제거 - SkeletonTab.jsx - Skeleton UI 구현 - DicoJsonCarousel.jsx - Carousel 구현중 * [#29] feat: ✨ PopUp Skeleton UI 만들기 - Context.jsx - 주석 제거 - BestTab.jsx - 주석 제거 - PopUpContainer.jsx - Skeleton import - PopUpItemsSlide.jsx - 주석 제거 - SkeletonPopUpContainerBody.jsx - Skeleton UI 구현 * feat: ✨ carousel loop 기능 구현 * [#31] feat: ✨ README.md 작성완료 Co-authored-by: kowoohyuk <kowoohyuk91@gmail.com>
스텝별 작업 목록
Toaster
,Alamofire
학습 키워드
Alamafire
Toaster
Combine
FileManager
Cache
CollectionView
고민과 해결(질문거리)
셀을 표기할 때 이미 다운로드된 이미지가 있으면 표시하고, 새로운 파일이 다운로드 완료되면 해당 이미지를 테이블뷰 셀에 뒤늦게(lazy) 표시한다.
라고 명시가 되어있는데 lazy하게 표시하기 위해서 이미지를 lazy하게 불러오는 것이 저희가 작성한 흐름과 비교해서 맞는지도 의구심이 들고 있습니다.ErrorHandler
를 통해서 화면에 일단 표시해두고 있는데 이런 흐름도 맞는지 궁금합니다.부연 설명