Skip to content
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] #178-bottomsheet라이브러리로 구현 #181

Merged
merged 14 commits into from
Feb 11, 2025

Conversation

hooni0918
Copy link
Collaborator

@hooni0918 hooni0918 commented Feb 9, 2025

🔗 연결된 이슈

📄 작업 내용

  • 바텀시트 라이브러리 구현
  • 바텀시트 중복된 코드들 제거

동작 내용은 기존과 동일해서 생략합니다.

💻 주요 코드 설명

  1. FlexSheet 라이브러리를 추가했습니다. 스타눌러주세요
  2. 기존 BottomSheetStyle, CustomBottomSheet, FixedBottomSheetView, BottomSheetList, SearchResultBottomSheet을 삭제하고 라이브러리로 통합 관리하게 되었습니다. 궁금하시면 라이브러리 코드 뜯어보시면 이해가 될겁니다.

지금 코드는 라이브러리를 가져다 사용하는게 많아서 라이브러리 사용법으로 PR설명을 갈음하겟습니다.

FlexibleBottomSheet(
    currentStyle: $currentStyle,
    style: .defaultFlex
) {
    // 사용자 인터랙션에 따라 높이가 변하는 바텀시트
    YourContent()
}

스타일 설정

// 기본 고정 스타일
FlexSheetStyle(
    fixedHeight: UIScreen.main.bounds.height * 0.5
)

// 기본 유동 스타일
.defaultFlex

// 인터랙티브 스타일
.interactiveFlex

👀 기타 더 이야기해볼 점

라이브러리 연동관련해서 코드가 좀 많이 더럽습니다 커밋단위말고 해당 PR 만 봐주세요!
스유 정말 어렵네요,, 라이브러리도 어렵다..
스크린샷 2025-02-10 오전 3 38 34
참...많은일이 있었습니다 하하

@hooni0918 hooni0918 added feat 기능구현시 사용 Jihoon 나는지훈 labels Feb 9, 2025
@hooni0918 hooni0918 self-assigned this Feb 9, 2025
Copy link
Member

@thingineeer thingineeer left a comment

Choose a reason for hiding this comment

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

라이브러리로 만드셔서 보기 좋네요! 다른 것도 모듈화한다면 도움이 될 것 같습니다.

Comment on lines 69 to 70
.navigationBarHidden(true)
.navigationBarHidden(true)
Copy link
Member

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.

엥? 이게뭐죠ㅋㅋㅋ

lhs.latitude == rhs.latitude &&
lhs.longitude == rhs.longitude &&
lhs.categoryColorResponse == rhs.categoryColorResponse
return lhs.placeId == rhs.placeId
Copy link
Member

Choose a reason for hiding this comment

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

필요한 부분만 남기는거 깔끔하네요

@State private var currentStyle: BottomSheetStyle = .half

var body: some View {
GeometryReader { geo in
Copy link
Member

Choose a reason for hiding this comment

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

반드시 GeometryReader를 사용해야 한다면 GeometryReaderFlexSheet에 넣어도 된다고 생각이 듭니다 .. 근데 GeometryReader를 쓰는 이유가 뭐였죠??

  • geo 값은 사용이 안 되는데 와일드카드 패턴을 써도 좋을 것 같아요

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

GeometryReader는 바텀시트의 확장조건 ( .mini .half .full) 의 상황이 비율로 움직이고 있었는데 이 비율에 대한 부분을 감지하기 위해 사용되었습니다. 이부분은 라이브러리로 구현을 해놓은 상태이구요.
현재는 바텀시트가 full 인 상황에서 스크롤뷰를 움직일때 스크롤뷰의 스크롤 영역조절을 위해 작성을 해놧었는데,, 필요가 없었네요!
현재 geo 매개변수가 사용되지 않는것도 스크롤뷰처리를 따로 하지 않아도 되기 때문에 사용자체가 될곳이 없습니다.
해당 부분 통으로 삭제하도록 할게요!

@State private var currentStyle: BottomSheetStyle = .half

var body: some View {
GeometryReader { geo in
Copy link
Member

Choose a reason for hiding this comment

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

여기도 와일드 카드!

Copy link
Collaborator

@juri123123 juri123123 left a comment

Choose a reason for hiding this comment

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

라이브러리로 빼니 깔끔해서 좋네요 !! 고생많으셨습니다 !

@State private var currentStyle: BottomSheetStyle = .half

var body: some View {
GeometryReader { geo in
Copy link
Collaborator

Choose a reason for hiding this comment

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

GeometryReader를 쓰는 이유가 몰까요? 저번에 사용하지 않는 방향으로 수정하지 않았었나요. ?!!? 정말 기억이 나지 않아 물어봅니다...

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

GeometryReader는 바텀시트의 확장조건 ( .mini .half .full) 의 상황이 비율로 움직이고 있었는데 이 비율에 대한 부분을 감지하기 위해 사용되었습니다. 이부분은 라이브러리로 구현을 해놓은 상태이구요.
현재는 바텀시트가 full 인 상황에서 스크롤뷰를 움직일때 스크롤뷰의 스크롤 영역조절을 위해 작성을 해놧었는데,, 필요가 없었네요!
현재 geo 매개변수가 사용되지 않는것도 스크롤뷰처리를 따로 하지 않아도 되기 때문에 사용자체가 될곳이 없습니다.
해당 부분 통으로 삭제하도록 할게요!


import SwiftUI

struct ScrollOffsetPreferenceKey: PreferenceKey {
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.

해당 코드도 필요없는게 맞네요! 라이브러리에 포함이 되어있어서 내부에서는 사용하지 않아도 됩니다

print("Failed to fetch data:", error)
isLoading = false
}
await viewModel.fetchLocationList(locationId: locationId)
Copy link
Collaborator

Choose a reason for hiding this comment

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

error throw 안되는 부분인가요?

@hooni0918 hooni0918 merged commit 899a952 into juri Feb 11, 2025
@hooni0918 hooni0918 deleted the feat/#178-bottomsheetLibary branch February 11, 2025 07:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat 기능구현시 사용 Jihoon 나는지훈
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[feat] 바텀시트 라이브러리 교체
4 participants