-
Notifications
You must be signed in to change notification settings - Fork 0
7주차 과제 #8
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
base: main
Are you sure you want to change the base?
7주차 과제 #8
Conversation
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.
석기업~ 석기업~
과제 고생하셨습니다!! 많이 배워가요
|
||
struct KimGaHyunBestListView: View { | ||
let items: [ContentModel] |
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.
ㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋ아 진짜 웃기다 ㅋㅋㅋㅋㅋ @mcrkgus
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.
ㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋ 아 ㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋ
VStack(spacing: 10) { | ||
Image(uiImage: item.thumbnail) | ||
.resizable() | ||
.frame(width: 160, height: 80) | ||
HStack(alignment: .top) { | ||
Image("number\(offset + 1)") | ||
.resizable() | ||
.aspectRatio(contentMode: .fit) | ||
.frame(width: 23) | ||
VStack(alignment: .leading) { | ||
Text(item.title) | ||
.foregroundStyle(.white) | ||
Text(item.description) | ||
.foregroundStyle(.gray) | ||
.font(.caption) | ||
Text("\(item.rating)%") | ||
.foregroundStyle(.gray) | ||
.font(.caption) | ||
} | ||
} | ||
} | ||
.frame(maxWidth: 160) |
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.
요런 부분은 따로 컴포넌트로 분리할 수 있어 보이는데, 하지 않으신 이유가 있는지 궁금해요!!
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.
저도 뎁스가 깊어지는 것 같아서 따로 Cell 등 ... 으로 분리하는 것도 좋아보여요 !
분리하지 않으신 이유는 저도 궁금합니다 ~ㅎㅎ
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.
이런 경우에 보통은 무조건 분리를 합니다.!! 이번에 시간이슈가 조금 있어서
추후에 리뷰 반영하도록 하겠습니다!!
if isShowRanking { | ||
Image("number\(offset+1)") | ||
} |
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.
isShowRanking
이 어떤 역할을 하는 변수인가요!! 궁금합니다ㅏ
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.
이탤릭체로 랭킹을 보여주는지 여부입니다!
리스트의 디자인이나 간격이 동일하기에 간단하게 isShowRanking으로 상황에따라 랭킹 숨김여부를 처리했어요!
enum MockData: Hashable { | ||
case thumbnail | ||
case banner | ||
case todayTving([ContentModel]) |
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.
오 이렇게 MockData를 enum
으로 관리하는 것도 좋아 보이네요! 배워갑니다
struct SwiftUIView: View { | ||
private let items = ["홈", "드라마", "예능", "영화", "스포츠", "뉴스"] | ||
var body: some View { | ||
ScrollView { | ||
HeaderView() | ||
MenuView(items: items) | ||
ForEach(MockData.items, id: \.self) { type in | ||
switch type { | ||
case .thumbnail: | ||
Image(.main) | ||
.resizable() | ||
case let .todayTving(items): | ||
MovieListView(items: items, title: "오늘의 티빙 TOP 20", isShowRanking: true) | ||
case let .popularLive(items): | ||
LivePopularListView(items: items) | ||
case let .popularMovie(items): | ||
MovieListView(items: items, title: "실시간 인기 영화") | ||
case .banner: | ||
Image(.banner) | ||
.resizable() | ||
.aspectRatio(contentMode: .fit) | ||
.padding(.vertical, 20) | ||
case let .sport(items): | ||
SportListView(items: items) | ||
case let .kimGahyunBest(items): | ||
KimGaHyunBestListView(items: items) | ||
} | ||
} | ||
FooterView() | ||
} | ||
.background(.black) | ||
} | ||
} |
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.
MockData.item
을 기반으로 섹션을 동적으로 구성하는 방법도 좋아보이네요!
UI변경에 유리해 보입니다 👍🏻 (예를 들어 갑자기 기획이 섹션의 순서를 바꾸자 하면 배열 순서만 바꾸면 되니까!!)
많이 배워갑니다ㅏㅏ
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.
스유 장인 ㄷ ㄷ .. 승원이가 남겨준 부분에도 많이 공감이 됐어요 !
코드 너무 깔끔하고 .. 멋지고 .. 많이 배워갑니다 ~~👍🏻
|
||
struct KimGaHyunBestListView: View { | ||
let items: [ContentModel] |
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.
ㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋ 아 ㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋ
VStack(spacing: 10) { | ||
Image(uiImage: item.thumbnail) | ||
.resizable() | ||
.frame(width: 160, height: 80) | ||
HStack(alignment: .top) { | ||
Image("number\(offset + 1)") | ||
.resizable() | ||
.aspectRatio(contentMode: .fit) | ||
.frame(width: 23) | ||
VStack(alignment: .leading) { | ||
Text(item.title) | ||
.foregroundStyle(.white) | ||
Text(item.description) | ||
.foregroundStyle(.gray) | ||
.font(.caption) | ||
Text("\(item.rating)%") | ||
.foregroundStyle(.gray) | ||
.font(.caption) | ||
} | ||
} | ||
} | ||
.frame(maxWidth: 160) |
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.
저도 뎁스가 깊어지는 것 같아서 따로 Cell 등 ... 으로 분리하는 것도 좋아보여요 !
분리하지 않으신 이유는 저도 궁금합니다 ~ㅎㅎ
아래의 리뷰에는 코멘트가 안달리네요..ㅎㅎ |
📌 관련 이슈
✅ 과제 내용
🍎 문제 해결
기존의 화면플로우를 그대로 활용하고 싶어서 UIHostingController를 사용해서 기존의 플로우는 유지하고 메인화면만 SwiftUI로 구현했습니다.
각각의 컬렉션뷰는 title, items를 외부에서 설정할 수 있도록 컴포넌트화 했습니다. 이 외에도 헤더 푸터도 비슷하게 컴포넌트롤 분리했습니다.
📸 시연연상