Skip to content

Commit

Permalink
Merge pull request #9 from f-lab-edu/fix/7
Browse files Browse the repository at this point in the history
[#7] 홈 화면 데이터가 없을 시 화면에 섹션이 추가되지 않도록 수정
  • Loading branch information
letskooo authored Nov 21, 2024
2 parents 6763e52 + c6ac79f commit a1da447
Showing 1 changed file with 15 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,21 @@ final class HomeContentsView: UIView {

/// 섹션 추가는 이 곳에서 하시면 됩니다.
private func updateContentsSections() {
contentsSections = [
HomeTodayPickView(homeVM: homeVM, sectionTitle: "오늘의 PICK", postData: homePostData?.todayPickPostData ?? Post(post_id: "1", postUIType: .normal, postCategory: .art, postTitle: "테스트", postThumbnailImage: "blackScreen")),
HomeHorizontalCollectionView(homeVM: homeVM, sectionTitle: "새로 게시된 지식", postData: homePostData?.newPostData ?? []),
HomeHorizontalCollectionView(homeVM: homeVM, sectionTitle: "이번 주 TOP10", postData: homePostData?.weeklyTopPostData ?? []),
HomeHorizontalCollectionView(homeVM: homeVM, sectionTitle: "회원님이 좋아할 만한", postData: homePostData?.customizedPostData ?? []),
HomeGridCollectionView(homeVM: homeVM, sectionTitle: "추가 그리드 섹션", postData: homePostData?.gridData ?? []),
HomeEditorRecommendCollectionView(homeVM: homeVM, sectionTitle: "에디터 추천 지식", postData: homePostData?.editorRecommendationPostData ?? [])
]
if let data = homePostData?.todayPickPostData {
contentsSections.append(HomeTodayPickView(homeVM: homeVM, sectionTitle: "오늘의 PICK", postData: data))
}
if let data = homePostData?.newPostData {
contentsSections.append(HomeHorizontalCollectionView(homeVM: homeVM, sectionTitle: "새로 게시된 지식", postData: data))
}
if let data = homePostData?.weeklyTopPostData {
contentsSections.append(HomeHorizontalCollectionView(homeVM: homeVM, sectionTitle: "이번 주 TOP10", postData: data))
}
if let data = homePostData?.customizedPostData {
contentsSections.append(HomeHorizontalCollectionView(homeVM: homeVM, sectionTitle: "회원님이 좋아할 만한", postData: data))
}
if let data = homePostData?.editorRecommendationPostData {
contentsSections.append(HomeEditorRecommendCollectionView(homeVM: homeVM, sectionTitle: "에디터 추천 지식", postData: data))
}

for section in contentsSections {
stackView.addArrangedSubview(section)
Expand Down

0 comments on commit a1da447

Please sign in to comment.