-
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
[Design] 태그뷰 디자인하기 #470
base: develop
Are you sure you want to change the base?
[Design] 태그뷰 디자인하기 #470
Conversation
…perAcademy-POSTECH/2024-MacC-A05-Chillin into Design/#465-designTagView # Conflicts: # Presentation/Home/TagView.swift # Reazy.xcodeproj/project.pbxproj
…/2024-MacC-A05-Chillin into Design/#465-designTagView # Conflicts: # Presentation/Home/HomeSearch/Cell/HomePDFCell.swift # Presentation/Home/HomeSearch/Cell/PDFTagCell.swift # Presentation/Home/HomeView.swift
…perAcademy-POSTECH/2024-MacC-A05-Chillin into Design/#465-designTagView # Conflicts: # DesignSystem/Views/DynamicCellLayout.swift # Domain/Entities/Tag.swift # Presentation/Home/HomeSearch/Cell/HomePDFCell.swift # Presentation/Home/HomeSearch/Cell/PDFTagCell.swift # Presentation/Home/HomeSearch/HomeSearchView.swift # Presentation/Home/HomeView.swift # Presentation/Home/TagSearch/TagView.swift # Presentation/Home/TagSearch/TagViewModel.swift # Reazy.xcodeproj/project.pbxproj
let itemWidth = item.itemWidth(isEditMode: isEditMode ?? false) | ||
if currentWidth + itemWidth + 10 >= screenWidth { |
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.
편집 모드일 때는 아이템 너비가 더 넓어져야 함.
따라서 isEditMode인지 Bool 값으로 판단 후 길이 계산
4ab9e2c
to
ee052d8
Compare
DesignSystem/Views/CustomAlert.swift
Outdated
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.
커스텀한 Alert 뷰 재사용할 수 있도록 만들어 두었습니다
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 DynamicCell { | ||
func itemWidth(isEditMode: Bool) -> CGFloat { | ||
let padding: CGFloat = isEditMode ? 35 : 16 |
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.
DynamicCellLayout에서 셀의 너비를 계산하는 과정에서 셀 안의 패딩 값 계산이 빠져있더라구요.
-> 그러다보니 셀이 줄바꿈하는 과정에서 오차가 발생해서 해당 코드로 추가해두었습니다
( 셀을 삭제하는 x 버튼이 있냐 없냐에 따라 패딩 값이 달라져서 isEditMode에 따라 바뀌도록 설정합니다 )
Presentation/Home/HomeView.swift
Outdated
// 태그 생성 | ||
if tagViewModel.createTag { | ||
CreateTagView() | ||
.environmentObject(tagViewModel) | ||
} | ||
if tagViewModel.showDeleteAlert { | ||
CustomAlert(mainText: "\"\(tagViewModel.getTagName())\"\n태그를 삭제하시겠습니까?", | ||
message: "해당 태그가 달린 모든 논문에서도 삭제됩니다.", | ||
cancleAction: { tagViewModel.showDeleteAlert = false }, | ||
confirmAction: tagViewModel.deleteTag) | ||
} |
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.
이건 제 개인적인 생각인데 해당 뷰가 상시 나오는게 아닌 필요할 때 한번식 나오는 뷰인 만큼 안에 넣는거 보단 overlay에 넣어놓는 것이 뭔가 분리되는 느낌이 들어 해당 뷰가 어떤 뷰인지 더욱 직관적으로 확인할 수 있다고 생각합니다!
쿠로는 어떻게 생각하시나용
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.
오 좋은 거 같아요! 분리해서 적용해보겠습니당
} | ||
|
||
// MARK: - 태그를 선택하지 않음 | ||
struct TagLEmptyView: View { |
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.
오타 있습니다!
struct TagLEmptyView: View { | |
struct TagEmptyView: View { |
VStack(alignment: .center, spacing: 0) { | ||
VStack { | ||
if tagViewModel.isTagExist { | ||
TagListView(selectedTags: $tagViewModel.selectedTags, toggleTag: tagViewModel.tagTapped) |
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.
Environment로 하위 뷰(TagListView)에서 뷰모델에 접근할 수 있는데 바인딩으로 연결해서 따로 빼신 이유가 있으신 건가요??
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.
엇 그러네요 ?? 왜 바인딩으로 했는지 기억이 잘...안납니다 ㅎㅎㅜ 수정해둘게요 !!
guard let index = tags.firstIndex(where: { $0.name == tagName }) else { return } | ||
tags[index].isSeleted.toggle() | ||
|
||
if tags[index].isSeleted { | ||
selectedTags.append(tags[index]) | ||
} else { | ||
selectedTags.removeAll { $0.id == tags[index].id } | ||
} |
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.
tags에서 isSeleted된 애들만 filter로 넣어주려 했는데
그렇게 하니까 순서가 tags에 저장된 대로 들어가더라구요
그래서 그냥 append, remove하는 방식으로 만들었습니다!
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.
LGTM!
고생 많으셨습니다!!
private func setBindings() { | ||
$tags | ||
.map { !$0.isEmpty } | ||
.assign(to: \.isTagExist, on: self) | ||
.store(in: &cancellables) | ||
} |
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.
뷰 모델 사라질 때 구독 취소가 될 수 있게 deinit 추가해주세요!!
변경 사항
스크린샷 or 영상 링크
2025-03-08.7.59.02.mov
팀원에게 전달할 사항(Optional)
일단... 제가 디벨롭 머지하면서 혹여나 빼먹은 부분이 있을 수 있어요 ㅜ
그러다보니 추가된 코드들이 꽤 생겼어요! -> 확인해 주시고 이상한 부분이 있다면 꼭 말씀해주세요 !!
(아래 코드에 코멘트 달아두었으니 참고해주시면 됩니다)
close #465