-
Notifications
You must be signed in to change notification settings - Fork 0
[Feat] TabBarController, ToastView 작성 및 ConstraintMaker 익스텐션 구현 #120
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
Conversation
JinUng41
left a comment
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.
종류 정의와 그에 따른 매핑 코드가 이해하기 쉽도록 구성되어져서 사용하기에 간편할 것 같습니다.
정말 좋은 코드를 작성해 주신 것 같아요!
몇 가지 코멘트만 확인 부탁드려요~
Figma에 반영이 되지 않은게 자꾸 나와서 참으로 속상하네요..ㅠㅠ
| @discardableResult | ||
| func widthEqualTo(_ float: CGFloat) -> ConstraintMakerEditable { | ||
| return self.width.equalTo(float.adjustedWidth) | ||
| } |
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.
메서드 명을 adaptiveWidthEqualTo 혹은 adjustedWidthEqualTo라고 변경가능함도 생각해 보았습니다.
물론 지금의 방식도 상관없을 것 같아요.
그냥 그런 생각이 들었기에 말씀드려봅니다.
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.
저도 adjustedWidthEqualTo가 조금 더 메서드의 의도를 잘 나타내는 것 같다는 생각이 드네요! 좋은 의견 감사합니다.
widthEqualTo를 가져갔을 때 문제가 되는 상황도 있을까요? 일단 adjustedWidthEqualTo로 리팩토링 진행해보겠습니다.
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.
사실 괜한 걱정일수도 있는데요.
모르는 사람이 사용되는 코드만 보면 SnapKit의 equalTo가 있는데, widthEqualTo는 왜 구현했을까 하는 생각이 들 수도 있겠다는 생각이 들어서요.
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.
이미 있는 메서드랑 네이밍이 중복돼서 더 그렇게 느껴질 수도 있겠네요 !! 좋은 의견 감사드립니다 ㅎㅎ 리뷰 반영했습니다!
|
|
||
| extension CGFloat: ScreenAdjustable { | ||
| extension CGFloat { | ||
| /// 기준 해상도에 대한 너비 비율 (기본값: 375pt) | ||
| private static let widthRatio: CGFloat = UIScreen.main.bounds.width / 375 |
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.
이 extension의 영역이 fileprivate으로 제한된다면, 외부에서 CGFloat 값을 선언 후 사용할 때 adjusted 와 같은 내용을 몰라도 되어서 은닉화를 이룰 수 있을 것 같습니다만, 어떻게 생각하실까요?
fileprivate extension CGFloat {}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.
앗 제가 이 부분을 본문에 적어둔다는 걸 깜빡했네요 ...!! UIView 익스텐션의roundCorners 메서드에서 cornerRadius를 설정하는 부분을 adjustedWidth에 맞춰 변경했는데요. filePrivate 키워드를 사용하면 해당 익스텐션에서 adjustedWidth를 사용할 수 없기 때문에 키워드를 사용하지 않았습니다.
func roundCorners(_ corners: [Corner], radius: CGFloat) {
layer.cornerRadius = radius.adjustedWidth
layer.masksToBounds = true| // MARK: - Page Types | ||
|
|
||
| /// 페이지 타입을 정의하는 `PageType` 열거형. | ||
| /// | ||
| /// - `plain`: 일반 페이지 | ||
| /// - `detail`: 상세 페이지 (뒤로가기 버튼 포함) | ||
| /// - `profile`: 프로필 페이지 (메뉴 버튼 포함) | ||
| enum PageType { | ||
| case plain | ||
| case detail | ||
| case profile | ||
| } |
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.
Navigation Type의 중첩 타입으로 PageType을 구현하는 것은 어떠실까요?
처음에 분리가 되있어, NavigationType * PageType을 조합하여 네비게이션 바를 이룰 수 있는건가 하는 의문이 생겼었습니다.
헷갈릴 수 있는 여지가 있을 것 같아요!
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.
엇 저도 그 부분을 좀 우려했는데 중첩 타입으로 정의하면 타입 간 관계가 조금 더 명확해질 수 있을 것 같아요! 좋은 의견 감사합니다 ㅎㅎ 반영해보겠습니다!
| /// - `home`: 메인 화면에 사용되는 네비게이션 타입 | ||
| /// - `hasNewNotification`: 새로운 알림 존재 여부, 해당 값에 따라 알림 버튼 이미지 변경 |
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.
안타깝게도 안드로이드와 아요 모두 마찬가지로 홈 네비게이션 바에 알림 아이콘은 존재하지 않아요.
아무래도 구현하는 중에 제외되었는데 미처 반영되지 않은 것 같아요.
이 부분은 제가 TL에게 직접 연락해서 반영되도록 하겠습니다.
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.
유진님께서 설명하신 부분이 맞았습니다.
오히려 제가 미처 파악하지 못한 부분이었네요,, 죄송합니다!
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.
아닙니다 ㅎㅎ 다시 반영했습니다!
| else { return } | ||
|
|
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.
아래와 같이 개행되어야 합니다!
else {
return
}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.
엇 반영했습니다 !! 😳
[Feat] TabBarController, ToastView 작성 및 ConstraintMaker 익스텐션 구현
👻 PULL REQUEST
📄 작업 내용
ToastView를 구현했어요.Enum케이스로 분리해TabBarController내에서 간편하게 사용할 수 있는 커스텀NavigationView를 구현했어요.TabBarController를 구현하고SceneDelegate에 연결했어요.ConstraintMaker익스텐션을 선언해SnapKit을 이용한 제약조건 설정 시 adjustedWidth와 adjustedHeight를 자동으로 적용할 수 있는widthEqualTo,heightEqualTo메서드를 구현했어요.💻 주요 코드 설명
커스텀 ToastView 구현
ToastView에서는ToastTypeEnum을 이용해 토스트 메시지 타입을 정의합니다./// 제약조건 설정 private func setupConstraint() { statusImageView.snp.makeConstraints { $0.centerY.equalToSuperview() $0.leading.equalToSuperview().offset(12) $0.widthEqualTo(32) $0.heightEqualTo(32) } statusLabel.snp.makeConstraints { $0.verticalEdges.equalToSuperview().inset(8) $0.leading.equalTo(statusImageView.snp.trailing).offset(6) } } ... func show() { guard let windowScene = UIApplication.shared.connectedScenes.first as? UIWindowScene, let window = windowScene.windows.first else { return } window.addSubview(self) self.snp.makeConstraints { $0.top.equalToSuperview().offset(76) $0.horizontalEdges.equalToSuperview().inset(16) $0.height.greaterThanOrEqualTo(48.adjustedHeight) } animate() }커스텀
NavigationView및TabBarController구현configureVisibleView()를 구현해 적용했습니다.ConstraintMaker익스텐션adjustedWidth와adjustedHeight를 자동으로 적용할 수 있는widthEqualTo,heightEqualTo메서드를 구현했습니다.👀 기타 더 이야기해볼 점
🔗 연결된 이슈