-
Notifications
You must be signed in to change notification settings - Fork 6
[Feat ]#134 - 보관함편집기능구현 #137
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
The head ref may contain hidden characters: "#134-\uBCF4\uAD00\uD568\uD3B8\uC9D1\uAE30\uB2A5\uAD6C\uD604"
Conversation
lsj8706
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.
이 기능 구현은 Combine과 사실상 무관해요..!
PrivateCourseListView에서 didSelectItemAt만 아래처럼 수정하면 될 것 같아요!
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
if !isEditMode {
cellDidTapped.send(indexPath.item)
}
}기존 코드에 Combine이 부분 적용되어 있지만 이 기능과는 독립적인 것으로 보이니 무시하고 하던대로 작업하시면 됩니다. Protocol-Delegate 패턴의 전형적인 사례이니 제대로 공부해서 적용해봅시다~! 재현이와 같이 온라인으로라도 상의하면서 작업하면 좋을 것 같아요!
Runnect-iOS/Runnect-iOS/Presentation/CourseDetail/VC/CourseDetailVC.swift
Outdated
Show resolved
Hide resolved
|
|
||
| private let scrapProvider = Providers.scrapProvider | ||
|
|
||
| private var courseId: Int? |
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.
이 변수는 삭제할 코스의 Id를 담고 있는 걸까요..?
그렇다면 이 상태에서는 코스를 1개만 삭제할 수 있을 거 같은데 저희가 원하는건 여러개를 동시에 삭제할 수 있는 기능 같아요!
변수 명도 courseId라고 하면 너무 추상적이니까 courseIdsToDelete 이런식으로 구체적으로 적어주세요
private var courseIdsToDelete: [Int] = []이런식으로 어레이로 만들어서 여러개를 한번에 지울 수 있도록 할 것 같아요
| private var selectedIndex: Int? { | ||
| didSet { | ||
| if selectedIndex == nil { | ||
| deleteCourseButton.setEnabled(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.
마찬가지로 이러면 하나의 cell만 선택가능 할 것 같아요 어레이로 선택된 Cell의 인덱스들을 관리해야할 것 같습니다
| // protocol PrivateCourseListViewDelegate: AnyObject { | ||
| // func deleteCourseButtonDidTap() | ||
| //} |
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.
protocol-delegate 패턴을 이용해 상위 VC인 CourseStorageVC에 선택된 코스들의 id 어레이를 넘겨주는 방식으로 해야할 것 같습니다.
| // protocol PrivateCourseListViewDelegate: AnyObject { | |
| // func deleteCourseButtonDidTap() | |
| //} | |
| protocol PrivateCourseListViewDelegate: AnyObject { | |
| func deleteCourseButtonDidTap(courseIdsToDelete: [Int]) | |
| } |
| let deleteVC = RNAlertVC(description: "코스를 정말로 삭제하시겠어요?") | ||
| deleteVC.rightButtonTapAction = { [weak self] in | ||
| deleteVC.dismiss(animated: false) | ||
| // self?.deleteCourse() |
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.
여기서는 앞서 protocol-delegate 패턴으로 만들어둔 함수를 실행시켜서 상위뷰인 CourseStorageVC에 선택된 코스들의 id들을 넘겨줘야 해요.
위에 단 리뷰가 반영되었다는 가정하에
delegate?.deleteCourseButtonDidTap(courseIdsToDelete: 선택된 코스 아이디 어레이)이렇게 되겠네요
lsj8706
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.
컨플릭트 해결해주세요...!!!
Runnect-iOS/Runnect-iOS/Presentation/CourseDetail/VC/CourseDetailVC.swift
Outdated
Show resolved
Hide resolved
| // 제스처 인식기 추가 | ||
| let swipeLeftGesture = UISwipeGestureRecognizer(target: self, action: #selector(handleSwipeGesture(_:))) | ||
| swipeLeftGesture.direction = .left | ||
| bannerCollectionView.addGestureRecognizer(swipeLeftGesture) | ||
|
|
||
| let swipeRightGesture = UISwipeGestureRecognizer(target: self, action: #selector(handleSwipeGesture(_:))) | ||
| swipeRightGesture.direction = .right | ||
| bannerCollectionView.addGestureRecognizer(swipeRightGesture) |
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.
콜렉션뷰로 배너를 만들었는데 또 UISwipeGestureRecognizer를 추가한 이유가 있을까요?
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.
자동으로 넘어가는 배너인지 모르고 수동으로 하려다가.. 뭔가 미는 제스쳐를 추가해야 할 것 같아서 했는데 배너는 자동으로 넘어가게 다 수정해야합니다
Runnect-iOS/Runnect-iOS/Presentation/CourseDiscovery/Views/AdImageCollectionViewCell.swift
Outdated
Show resolved
Hide resolved
| } | ||
| } | ||
|
|
||
| private func hiddenViews(withDuration: TimeInterval = 0) { |
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.
함수명이 애매하네요! hideHiddenViews를 의도하신 걸까요?
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.
맞아요..바꿨어요 ..
| <<<<<<< HEAD | ||
| view.addSubviews(naviBar, viewPager, deleteCourseButton) | ||
| view.bringSubviewToFront(viewPager) | ||
| ======= |
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.
ㅠㅠ넵
lsj8706
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.
코멘트 확인해주세요!
| @discardableResult | ||
| func setButtonTitle(_ leftButtonTitle: String, _ rightButtonTitle: String) -> Self { | ||
| self.yesButton.setTitle(rightButtonTitle, for: .normal) | ||
| self.noButton.setTitle(leftButtonTitle, for: .normal) | ||
| return self | ||
| } |
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.
넵 ! delegate부분 아마 다 안쓰는 거였어서 지웠습니다
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.
이거는 delegate랑은 관련 없고 그냥 버튼 타이틀 텍스트 바꾸는 코드 같아요
| <<<<<<< HEAD | ||
| do { | ||
| let responseDto = try result.map(BaseResponse<ActivityRecordInfoDto>.self) | ||
| } catch { | ||
| print(error.localizedDescription) | ||
| } | ||
| ======= |
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.
아이거 없애도 계속 생기네..용..?
| } | ||
|
|
||
| @objc func deleteRecordButtonDidTap() { | ||
| let deleteAlertVC = RNAlertVC(description: "러닝 기록을 정말로 삭제하시겠어요?").setButtonTitle("취소", "삭제하기") |
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.
여기에 .setButtonTitle 다시 살려주세요...!!!!
| // 수정 모드일 때 | ||
| self.setEditMode() | ||
| }) | ||
| let deleteAlertVC = RNAlertVC(description: "러닝 기록을 정말로 삭제하시겠어요?").setButtonTitle("취소", "삭제하기") |
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.
이것도 다시 살려주세요~~
lsj8706
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.
수고 많으셨습니다~~!!
🌱 작업한 내용
🌱 PR Point
5/18 피알 포인트
<구 피알포인트>
📸 스크린샷
📮 관련 이슈