Skip to content

[feat] 사이드 바 UI 구현 #141

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

Merged
merged 14 commits into from
Nov 27, 2023

Conversation

otoolz
Copy link
Collaborator

@otoolz otoolz commented Nov 27, 2023

🌎 PR 요약

사이드 바 UI를 작업했어요.

🌱 작업한 브랜치

📚 작업한 내용

  • 사이드바 UI
  • 컨테이너 뷰컨트롤러 작성
    • 사이드바VC, 홈VC를 child 뷰컨으로 관리
    • 그림자 뷰 처리

📍 참고 사항

  • SceneDelegate에 rootViewController를 컨테이너 뷰컨으로 바꿨습니다.
        let containerVC = ContainerVC()
        window?.rootViewController = containerVC
  • homeVC 에서 네비게이션 바에 사이드바 버튼과 Container VC에서 사용할 homeViewDelegate를 추가했습니다.

📸 스크린샷

Simulator.Screen.Recording.-.iPhone.15.Pro.-.2023-11-27.at.12.59.57.mp4

관련 이슈

@otoolz otoolz added 🍎 iOS iOS 작업 시 🌈 Design View, 디자인 작업 시 labels Nov 27, 2023
@otoolz otoolz self-assigned this Nov 27, 2023
Copy link
Collaborator

@0inn 0inn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

사이드뷰도 많이 복잡했네요 ㅜㅜ 고생하셨습니다 👍🏻
혹시 ContainerVC 네이밍을 좀 더 명시적으로 바꾸는 건 어떨까요 ?!
RootContainerVC라던지 ,, 등등 의견있으면 주십쇼 !!ㅎㅎ

네이밍 관련한 부분들 여기서 해결하고 넘어가는 게 좋을 것 같아서 일단 r-c요청 해놓겠습니다 :)

Comment on lines 46 to 52
UIView.animate(
withDuration: 0.5,
delay: 0,
usingSpringWithDamping: 1.0,
initialSpringVelocity: 0,
options: .layoutSubviews,
animations: {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

q; 현재 뷰가 애니메이션이 적용된 상황인가요 ?!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

아니요. 적용이 안됐습니다 😭
이 부분은 좀더 고민해보겠습니다!

})
}

private func closeSideMenu(_ completion: (() -> Void)?) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

p2; 여기 completion이 하는 역할이 뭔가요 ?
nil만 넘겨주고 있는 것 같은데 추후에 다른 클로저가 넘어올 일이 있나요 ?!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

앗 아뇨. 나중에 지운다는걸 그냥 넘긴것 같습니다. 👍

Comment on lines 87 to 90
addChild(navigationVC)
view.addSubview(navigationVC.view)
navigationVC.didMove(toParent: self)
self.navigationVC = navigationVC
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

오 ,, 이게 혹시 어떤 흐름인지 ,, 알려주실 수 있나요 ,, 제가 ,, 이해가 도저히 안돼서 , 죄송합니다.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이게 컨테이너 뷰컨트롤러를 통해서 사이드바 뷰컨트롤러랑 메인 뷰 컨트롤러를 화면에 동시에 띄워주려면
사이드바와 메인 뷰 둘다 부모-자식 뷰컨 관계가 되어야한다고 알고있어서 그 관계를 설정해주는 부분입니다.
근데 여기에 자식 뷰컨의 뷰도 같이 addSubView로 넣어줘야 하더라구요.

@@ -43,5 +43,6 @@ enum TLImage {

enum Home {
static let close = TravelineAsset.Images.closeMedium.image
static let menu = TravelineAsset.Images.menu.image
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

우악. Home 지워뒀는데 ㅎㅎ 죄송 . . 먼저 머지하시면 제가 해결하겠습니다 ~

return view
}()

private let profileLabel: ProfileLabel = .init()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

p2; 버튼인데 Label이란 네이밍이 좀 어색해서 혹시 myPostListButton으로 하는 건 어떨까요 ?
나머지 Label들도 마찬가지일 것 같아요 !

Comment on lines 158 to 162
if view === menuView {
return false
}
return true
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

여기가 그림자쪽 터치해서 사라지게 하는 로직이군요 👍🏻🚀
== 말고 ===로 비교가 필요한 이유가 있었나요 ? (정말 궁금 ㅎㅎ)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

오호 .. 저는 터치에 걸린 뷰가 menuView가 맞는지 확인할 때, 참조하고 있는 뷰가 같은지 확인하려고 ===을 써줬었습니다!
근데 == 로 비교해도 잘되네요 ㅎㅎ

Comment on lines 75 to 76
func setupAttributes() {
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

p3; 여기서 쓸 일 없으면 지워도 될 것 같습니다 :)

Copy link
Member

@kth1210 kth1210 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

고생하셨습니다 기웅님~!~! 🥺
Container 활용하는건 안해봤었는데 신기하네용,,,,

궁금한 점들 코멘트 남겨두었습니닷닷

Comment on lines 105 to 107
self.sideMenuVC.view.insertSubview(shadowView, at: 0)
self.sideMenuVC.view.isHidden = true

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

q; shadowView를 sideMenuVC 외부에서 생성해서 insert 해주시는 이유가 있나용??

추가로 shadowView만 AutoLayout이 아니라 frame + autoresizingMask를 적용하신 이유도 궁금합니당

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

처음에는 홈뷰컨과 사이드바뷰컨 사이를 가려주는거라 외부인 containerVC에서 생성해주는 맞다고 생각했었습니다.
그런데 이걸 홈뷰컨에 insert해서 서치바가 안가려지는 문제가 있었는데 이걸 사이드바 뷰컨에 넣어줘서 해결했었습니다.
근데 지금 댓글을 보면서 사이드바 뷰컨에 옮겨야하나.. 고민하고 있었는데
containerVC에 view.insertSubview(shadowView, at: 1)로 해주니 아주 잘 가려지는군요..?

autoresizingMask를 쓴건 가로화면으로 전환했을 때, 넓이가 그대로 있는데 저걸 쓰면 다 가려주게되서 사용했습니다!

Comment on lines 119 to 121
tapGesture.numberOfTapsRequired = 1
tapGesture.delegate = self
tapGesture.isEnabled = true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

p2; numberOfTapsRequiredisEnabled는 기본값이 1과 true라서 따로 지정안해주셔도 될 것 같습니당 🙂

Comment on lines 65 to 67
func addTarget(_ target: Any?, action: Selector, for event: UIControl.Event) {
editButton.addTarget(target, action: action, for: event)
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

p3; 이렇게 되면 이 메서드를 사용할 때 ProfileLabel이라는 view에 addTarget 하는 것 같지만 editButton에만 addTarget이 되어서 뭔가 역할이 좀 모호한? 느낌이 드는 것 같아요!

사용하는 VC에서 editButton에 대해 addTarget에 필요한 것이라면 editButton에 직접 addTarget 해줘도 되지않을까용
editButtonprivate이 풀려있는 것이 그걸 의도하셨던 것 같기도,,,

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

맞습니다 고민하다가 함수 만들어줬었는데 수정 바로 하겠습니다

@otoolz
Copy link
Collaborator Author

otoolz commented Nov 27, 2023

코드리뷰 내용 반영하고 애니메이션도 추가했습니다!

Simulator.Screen.Recording.-.iPhone.15.Pro.-.2023-11-27.at.21.22.08.mp4

@0inn
Copy link
Collaborator

0inn commented Nov 27, 2023

헉 애니메이션 최곤데요 🥹 넘 예뻐요 🌈

혹시 ContainerVC 네이밍을 좀 더 명시적으로 바꾸는 건 어떨까요 ?!
RootContainerVC라던지 ,, 등등 의견있으면 주십쇼 !!ㅎㅎ

코멘트 달아놨었는데 이건 어떻게 생각하시나요 ?!

@kth1210
Copy link
Member

kth1210 commented Nov 27, 2023

오오 애니메이션 넘 멋져요!!! 🙌
고생하셨슴닷

@otoolz otoolz merged commit 92897bc into boostcampwm2023:ios-develop Nov 27, 2023
@otoolz otoolz deleted the ios-feature/#58-sideBarUI branch November 27, 2023 20:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🌈 Design View, 디자인 작업 시 🍎 iOS iOS 작업 시
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants