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/NST-13] 그룹상세화면 구현 #33

Merged
merged 4 commits into from
Feb 8, 2025
Merged

Conversation

oyslucy
Copy link
Collaborator

@oyslucy oyslucy commented Feb 3, 2025

🔥 Issue

close #30


🔥 변경된 내용

  • Font 크기 변경 -> 했는데도 또 변경된 부분이 많은 것 같아서 갈아엎는게 좋을듯햅니다

🔥 PR Point

  • 기존에 없었던 변수 추가
    • Schedule은 주로 약속생성에, ExtendedSchedule은 주로 약속 확정에 쓰이는 구조체입니다
struct Schedule {
    let selectionDates: [Date]
    var selectionStartDate: Date? {
        return selectionDates.sorted().first
    }
    var selectionEndDate: Date? {
        return selectionDates.sorted().last
    }
    let selectionStartTime: Date
}

struct ExtendedSchedule {
    ///약속 날짜(1순위, 확정)
    let date: String
    ///약속 시작시각(1순위, 확정)
    let startTime: String
    ///약속 종료시각(1순위, 확정)
    let endTime: String
    ///그룹 총인원
    var groupMemberCount: Int
    ///가능한 인원
    var availableMemberCount: Int
}
  • GroupDetailViewControllerGroupDetailReactor, InProgressCVCInProgressReactor, ConfirmedCVCConfirmedReactor에서 관리해줍니다. 따로 셀의 reactor를 만든 이유는 cell.reactor로 바로 바인딩하기 위해서입니당. GroupDetailReactor 로직 중심으로 확인해주시면 감사하겠습니당

  • Floating Btn과 Navigationbar, Tabbar는 추후 추가될 예정이예용

@oyslucy oyslucy self-assigned this Feb 3, 2025
@oyslucy oyslucy added the Feat 새로운 기능 구현 label Feb 3, 2025
Copy link
Collaborator

@FpRaArNkK FpRaArNkK left a comment

Choose a reason for hiding this comment

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

캬 좋네요 야무지십니다 👍👍
멘트 몇 개 남겨놓았으니 확인해주시고, 트슈 기다릴게요~ ^^7

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

Choose a reason for hiding this comment

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

vector는 너무 포괄적인 이름 같아요! ic_arrow_right 같은 네이밍도 괜찮지 않을까요?

Comment on lines +91 to 92
///타임테이블 뷰 : "요일 월/일"
static func dateList(_ dateStrings: [String]) -> [String] {
Copy link
Collaborator

Choose a reason for hiding this comment

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

NSTDateUtility는 모든 개발자들이 사용하는 유틸리티일거에요.
본 유틸리티에서 static func으로 추가하여 사용한다면, 불특정 다수의 개발자가 해당 함수를 사용할 수 있겠죠?

  1. 다른 영역에서도 넓게 쓰일 수 있도록 함수 이름과 사용 예시를 명확히 정해주세요
    or
  2. 사용하는 뷰 내부에서 private하게 자체적으로 만들어 써도 될 것 같아요

둘 중 하나로 골라서 진행해보시면 좋을 것 같아요!

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 139 to 146
// 날짜 포맷: "9월 7일 (일)"
dateFormatter.dateFormat = "M월 d일 (E)"

// 시간 포맷: "10:00"
let timeFormatter = DateFormatter()
timeFormatter.locale = Locale(identifier: "ko_KR")
timeFormatter.timeZone = TimeZone(identifier: "Asia/Seoul")
timeFormatter.dateFormat = "HH:mm"
Copy link
Collaborator

Choose a reason for hiding this comment

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

해당 코드를 막기 위해 본 NSTDateUtility 코드가 존재한답니다!
해당 코드 문서와 PR 한번 읽고오시면 도움이 될거에요 :)

Copy link
Collaborator

Choose a reason for hiding this comment

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

CollectionViewCell은 작성하실 때 prepareForReuse가 필요한 부분은 없는지 한 번씩 확인해보세요!
해당 코드에서 disposeBag은 사용되지 않아 지워도 되겠지만, 만약 실제 Rx subscribe나 bind가 되어 있는경우 PrepareForReuse에서 disposeBag을 초기화해주세요.

Comment on lines +92 to +97
func bind(reactor: ConfirmedCellReactor) {
let schedule = reactor.currentState.schedule
chip.backgroundColor = schedule.schedule.category.displayColor
scheduleTitleLabel.text = schedule.schedule.name
timeLabel.text = NSTDateUtility.durationList(schedule.startTime, schedule.endTime)
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

rx 바인드하는 내용은 없으니 이름을 바꿔도 괜찮지 않을까요?!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

뷰컨트롤러에서 self.reactor=reactor 로 할당하기 위해 bind 메소드를 썼습미다

Comment on lines 34 to 37
let inProgressLayout = UICollectionViewFlowLayout()
let confirmedLayout = UICollectionViewFlowLayout()
self.inProgressCollectionView = UICollectionView(frame: .zero, collectionViewLayout: inProgressLayout)
self.confirmedCollectionView = UICollectionView(frame: .zero, collectionViewLayout: confirmedLayout)
Copy link
Collaborator

Choose a reason for hiding this comment

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

트러블 슈팅 기다리고 있겠습니다 ^^7

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

2차스프린트 전에는..

// MARK: setUpUI
private func setUpUI() {
profileImageView.do {
$0.layer.cornerRadius = 7.14
Copy link
Collaborator

Choose a reason for hiding this comment

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

이거 진짜에요?

Comment on lines 58 to 68
if index == 0 {
return Observable.concat([
.just(.selectSegment(index)),
.just(.loadInProgressData)
])
} else {
return Observable.concat([
.just(.selectSegment(index)),
.just(.loadConfirmedData)
])
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

해당 부분은 삼항연산자로 묶어주면 3줄로 축약해서 가독성을 높일 수 있을 것 같네요!

// MARK: - Bind Reactor
func bind(reactor: GroupDetailReactor) {
rootView.segmentedControl.rx.selectedSegmentIndex
.distinctUntilChanged()
Copy link
Collaborator

Choose a reason for hiding this comment

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

굳 👍

Comment on lines 139 to 140
// 날짜 포맷: "9월 7일 (일)"
dateFormatter.dateFormat = "M월 d일 (E)"
Copy link
Contributor

Choose a reason for hiding this comment

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

NSTDateUtility에 이 포맷 case로 추가 하면 돼요!

Comment on lines 34 to 37
let inProgressLayout = UICollectionViewFlowLayout()
let confirmedLayout = UICollectionViewFlowLayout()
self.inProgressCollectionView = UICollectionView(frame: .zero, collectionViewLayout: inProgressLayout)
self.confirmedCollectionView = UICollectionView(frame: .zero, collectionViewLayout: confirmedLayout)
Copy link
Contributor

Choose a reason for hiding this comment

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

이것도 함수로 묶어서 정리하면 좋을 거 같아요

import RxSwift
import UIKit

final class GroupDetailReactor: Reactor {
Copy link
Contributor

Choose a reason for hiding this comment

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

Reactor 는 Reactor 폴더로 따로 빼면 좋을 것 같습니다~

}
}

extension GroupDetailViewController: UICollectionViewDelegateFlowLayout {
Copy link
Contributor

Choose a reason for hiding this comment

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

마크 주석을 잘 사용하시는거 같습니다. 여기도 부탁 드려요!

Comment on lines 93 to 101
.bind(to: rootView.inProgressCollectionView.rx.items(cellIdentifier: InProgressCVC.identifier, cellType: InProgressCVC.self)) { index, reactor, cell in
cell.reactor = reactor
}
.disposed(by: disposeBag)

// 확정된 약속 바인딩
reactor.state.map { $0.confirmedCellReactors }
.do(onNext: { _ in self.rootView.confirmedCollectionView.reloadData() })
.bind(to: rootView.confirmedCollectionView.rx.items(cellIdentifier: ConfirmedCVC.identifier, cellType: ConfirmedCVC.self)) { index, reactor, cell in
Copy link
Contributor

Choose a reason for hiding this comment

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

index 사용 안 한다면 와일드카드 패턴을 사용하면 좋을 것 같습니다.

Comment on lines 48 to 50
DispatchQueue.main.async {
self.rootView.layoutIfNeeded()
}
Copy link
Contributor

Choose a reason for hiding this comment

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

여긴 꼭 필요한 Task 인가요? 꼭 필요하다면 왜 꼭 필요한가요??

import Then
import ReactorKit

final class InProgressCVC: UICollectionViewCell, View {
Copy link
Contributor

Choose a reason for hiding this comment

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

reactor를 매개변수로 받아서만 사용하는 것 같아요! View 프로토콜을 confirm안하면 bind 함수가 작동이 안되나요??

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

네 bind(reactor:)는 리액터 내장함수입니당

@oyslucy oyslucy merged commit 36ff4f5 into main Feb 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feat 새로운 기능 구현
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feat/NST-13] 그룹상세화면 구현
3 participants