Conversation
7 tasks
sssthnnhee
approved these changes
May 29, 2026
sssthnnhee
left a comment
There was a problem hiding this comment.
수민님~~~~ 이번주도 고생많으셨습니다!!!!
아주아주 많이 알아갑니다...
| WatchaContent(imageResource: .main1), WatchaContent(imageResource: .main3) | ||
| ] | ||
|
|
||
| static let partyMockData: [WatchaContent] = [ |
There was a problem hiding this comment.
저는. . 여기 하드코딩했는데...... 이렇게 직접 데이터를 넣으니까 아름답습니다
| // MARK: - Body | ||
|
|
||
| var body: some View { | ||
| VStack(alignment: .leading, spacing: 0) { |
There was a problem hiding this comment.
저 spacing 기본이 0인줄알았는데 이런 세상에
찾아보니까 8. 정도나 있다고 ...
지금 제. 코드가 고칠것투성이라는 것을 느낍니다
| .resizable() | ||
| .scaledToFill() | ||
| .frame(width: 35, height: 35) | ||
| .padding([.top, .trailing], 8) |
| .scrollTargetLayout() | ||
| .padding(.horizontal, sidePadding) | ||
| } | ||
| .scrollTargetBehavior(.viewAligned) |
| .frame(width: cardWidth, height: 180) | ||
| } | ||
| } | ||
| .padding(.horizontal, (screenWidth - cardWidth) / 2) |
There was a problem hiding this comment.
와.. 이렇게 해서 scrollTargetBehavior(.viewAligned) 를 햇을때
맨첫번째랑 맨마지막 카드도 제대로 정렬될수잇는거군요
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
🔗 7주차 과제
📄 작업 내용
🍎 기본 과제
🍏 심화 과제
💻 주요 코드 설명 및 Trouble Shooting 🚀
파일은 아래와 같이 구성했습니다.
1) View 재사용
먼저 동일한 UI를 가진 부분을 파악했습니다.
1) 상단에 큰 포스터 캐러셀 뷰(월간남친 포스터 부분), 방금 막 도착한 신상 컨텐츠, 왓고리즘, 공개예정 콘텐츠의 아이템들은 모두 둥근 포스터 이미지로 크기와 cornerRadius만 다르고 동일합니다.
->
PosterCardView를 구현한 뒤 여러 뷰에서 재사용했습니다. (cornerRadius를 변수로 받음)2) 공개 예정 콘텐츠 Header와 왓챠 파티 Header는 title 제외 동일합니다.
->
CommonHeaderView를 구현한 뒤 재사용했습니다. (title을 변수로 받음)3) 왓고리즘의 가로 스크롤 뷰와 공개 예정 콘텐츠의 가로 스크롤 뷰는 동일합니다.
->
CommonView를 구현한 뒤 재사용했습니다.2) Stack 활용
구독 탭의 전체 뷰는 세로 스크롤이 되지만 [상단 네비게이션바, 구독 스티키 헤더, 하단에 구독 시작하기 플로팅 뷰]는 스크롤 되면 안됩니다.
아래 코드와 같이, 가장 바깥 쪽에
ZStack을 두고 스크롤 되어야하는 부분은ScrollView안에VStack으로 감싸 넣어줬고, 스크롤 안되는 부분은ZStack안에Vstack안에 넣어줬습니다.3) 상태 기반 Navigation
WelcomeView에서 메인으로 버튼을 누르면WatchaTabBarView로 이동하도록 구현했습니다.3) Sticky Header
스크롤 위치(Offset)의 변화에 따라 헤더의 크기와 텍스트 스타일이 변경되는 스티키 헤더를 구현했습니다.
UIKit으로 구현했을 때와 거의 동일한 방법으로 구현했어요 !
- GeometryReader & PreferenceKey 활용
최상단에 투명한 뷰를 배치하고
GeometryReader로 minY 좌표를 확인하고PreferenceKey(ScrollOffsetPreferenceKey)를 통해 상위 뷰로 전달합니다.- progress
스크롤 offset을
threshold: 50.0을 기준으로 변화율로 확인합니다.- 구독 헤더 뷰는 계산된 progress 값만 주입받아 스타일을 변경합니다.
📚 참고자료
https://developer.apple.com/videos/play/wwdc2019/237/?time=1039
위 영상 추천합니다..!!
https://developer.apple.com/documentation/swiftui/understanding-the-navigation-stack
👀 To Reviewers
스유 만세...만세..만세..
7셈까지 다들 너무 고생 많았어요 !!!!! 코드 리뷰 많이 달아주세요 😘