-
Notifications
You must be signed in to change notification settings - Fork 0
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
Feat: 지도 탭 캐러셀 구현 + Extension 분리 #39
Conversation
static func createCarouselLayout(groupWidthDimension: CGFloat, | ||
groupHeightDimension: CGFloat, | ||
maximumZoomScale: CGFloat, | ||
minimumZoomScale: CGFloat) -> UICollectionViewLayout { | ||
let itemSize = NSCollectionLayoutSize(widthDimension: .fractionalWidth(1), | ||
heightDimension: .fractionalHeight(1)) | ||
let item = NSCollectionLayoutItem(layoutSize: itemSize) | ||
let groupSize = NSCollectionLayoutSize(widthDimension: .fractionalWidth(groupWidthDimension), | ||
heightDimension: .fractionalHeight(groupHeightDimension)) | ||
let group = NSCollectionLayoutGroup.horizontal(layoutSize: groupSize, subitems: [item]) | ||
let section = NSCollectionLayoutSection(group: group) | ||
section.orthogonalScrollingBehavior = .groupPagingCentered | ||
section.visibleItemsInvalidationHandler = { items, offset, environment in | ||
let containerWidth = environment.container.contentSize.width | ||
items.forEach { item in | ||
let distanceFromCenter = abs((item.center.x - offset.x) - environment.container.contentSize.width / 2.0) | ||
let scale = max(maximumZoomScale - (distanceFromCenter / containerWidth), minimumZoomScale) | ||
item.transform = CGAffineTransform(scaleX: scale, y: scale) | ||
} | ||
} | ||
return UICollectionViewCompositionalLayout(section: section) | ||
} |
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.
고생하셨습니다. 특이 사항 없어서 Approve 하겠습니다.
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.
고생하셨습니다~
[mapView, searchButton, currentLocationButton, uploadButton, carouselCollectionView].forEach { | ||
view.addSubview($0) | ||
$0.translatesAutoresizingMaskIntoConstraints = false | ||
} |
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.
결국 addSubviews는 안 쓰기로 합의가 된 것일까요 ?ㅅ?
} | ||
|
||
required init?(coder: NSCoder) { | ||
super.init(coder: coder) |
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.
여기도 backgroundColor = .white들어가야 하는거 아닌가요? 그냥 앱이 종료되는 것만 막는 장치일까요?
🧑🚀 PR 요약
해당 pr에서 작업한 내역을 적어주세요.
📌 변경 사항
변경사항 및 주의 사항 (모듈 설치 등)을 적어주세요.
📸 ScreenShot
작동, 구현화면
Linked Issue
close #26