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

목표 설정 버튼과 목표 타입 뷰 연결 #26

Merged
merged 4 commits into from
Nov 24, 2020
Merged

Conversation

seoulboy
Copy link
Collaborator

Issue Number

Close #25

변경사항

  • 의존성 목록

새로운 기능

  • 기능 목록

  • MVVM, Combine, 및 Coordinator 패턴을 적용하여 목표 설정 버튼과 GoalTypeView 연결

  • GoalTypeView를 테이블 뷰로 구현

  • Custom Cell을 만들어서 GoalTypeView에서 사용

  • GoalTypeView 에 Header 및 Footer 추가

  • Footer 에 지우기 버튼 추가

작업 유형

  • 신규 기능 추가
  • 버그 수정
  • 리펙토링
  • 문서 업데이트

체크리스트

  • Merge 하는 브랜치가 올바른가?
  • 코딩컨벤션을 준수하는가?
  • PR과 관련없는 변경사항이 없는가?
  • 내 코드에 대한 자기 검토가 되었는가?
  • 변경사항이 효과적이거나 동작이 작동한다는 것을 보증하는 테스트를 추가하였는가?
  • 새로운 테스트와 기존의 테스트가 변경사항에 대해 만족하는가?


protocol PrepareRunViewModelOutputs {
var userLocation: AnyPublisher<CLLocationCoordinate2D, Never> { get }
var goalTypePublisher: Published<GoalType>.Publisher { get }
Copy link
Collaborator

Choose a reason for hiding this comment

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

이거는 나중에 CurrentValueSubject<GoalType, Never> 로 변경하면 되겠네요

Copy link
Collaborator

Choose a reason for hiding this comment

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

그럼 아래 @published 를 대체하게 되는 건가요?

Copy link
Collaborator

Choose a reason for hiding this comment

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

네 그러면 @publishedPublished<GoalType>.Publisher이 둘을 합쳐줄 수 있을 것 같아요

Comment on lines 12 to 40
lazy var tableView: UITableView = {
let tableView = UITableView(frame: .zero, style: .plain)
tableView.layer.backgroundColor = UIColor.tertiarySystemBackground.cgColor
tableView.delegate = self
tableView.dataSource = self
tableView.estimatedRowHeight = 1
tableView.allowsSelection = true
tableView.alwaysBounceVertical = false
tableView.isScrollEnabled = false
tableView.register(GoalTypeCell.self, forCellReuseIdentifier: String(describing: GoalTypeCell.self))
tableView.separatorInset.left = 20
tableView.separatorInset.right = 20
tableView.layer.cornerRadius = 30
let header = UIView(frame: CGRect(x: 0, y: 0, width: view.frame.size.width, height: verticalTablePadding))
let footer = UIView(frame: CGRect(x: 0, y: 0, width: view.frame.size.width, height: verticalTablePadding * 2))
let clearButton = UIButton()
clearButton.translatesAutoresizingMaskIntoConstraints = false
clearButton.setTitle("지우기", for: .normal)
clearButton.setTitleColor(.label, for: .normal)
footer.addSubview(clearButton)
NSLayoutConstraint.activate([
clearButton.centerXAnchor.constraint(equalTo: footer.centerXAnchor),
clearButton.topAnchor.constraint(equalTo: footer.topAnchor, constant: 0),
clearButton.widthAnchor.constraint(equalToConstant: 50),
])
tableView.tableHeaderView = header
tableView.tableFooterView = footer
return tableView
}()
Copy link
Collaborator

Choose a reason for hiding this comment

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

오늘 너무나도 깔끔하게 UIView 코드를 짤 방안이 필요하다고 느끼게된 순간이네요...

Comment on lines +123 to +152
private func configureLayout() {
view.addSubview(mapView)
mapView.layer.addSublayer(mapGradientLayer)
mapView.translatesAutoresizingMaskIntoConstraints = false
NSLayoutConstraint.activate([
mapView.leadingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.leadingAnchor),
mapView.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor),
mapView.bottomAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor),
mapView.trailingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.trailingAnchor),
])

view.addSubview(setGoalTypeButton)
setGoalTypeButton.translatesAutoresizingMaskIntoConstraints = false
NSLayoutConstraint.activate([
setGoalTypeButton.bottomAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor, constant: -10),
setGoalTypeButton.centerXAnchor.constraint(equalTo: view.centerXAnchor),
setGoalTypeButton.widthAnchor.constraint(equalToConstant: LayoutConstant.setGoalWidth),
setGoalTypeButton.heightAnchor.constraint(equalToConstant: LayoutConstant.setGoalHeight),
])

view.addSubview(startButton)
startButton.translatesAutoresizingMaskIntoConstraints = false
NSLayoutConstraint.activate([
startButton.bottomAnchor.constraint(equalTo: setGoalTypeButton.topAnchor, constant: -10),
startButton.centerXAnchor.constraint(equalTo: view.centerXAnchor),
startButton.heightAnchor.constraint(equalToConstant: LayoutConstant.startButtonDiameter),
startButton.widthAnchor.constraint(equalTo: startButton.heightAnchor, multiplier: 1),
])
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

addSubView와 AutoLayout 로직은 분리하는게 좋겠어요


protocol PrepareRunViewModelOutputs {
var userLocation: AnyPublisher<CLLocationCoordinate2D, Never> { get }
var goalTypePublisher: Published<GoalType>.Publisher { get }
Copy link
Collaborator

Choose a reason for hiding this comment

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

그럼 아래 @published 를 대체하게 되는 건가요?

@whrlgus whrlgus merged commit 8e34b20 into master Nov 24, 2020
@whrlgus whrlgus deleted the feature/25 branch November 24, 2020 23:43
SHIVVVPP added a commit that referenced this pull request Dec 9, 2020
(#25 #26) ActivityScene TotalView 연결 및 Date PickerView 구현
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

러닝 준비 화면: 목표 설정 버튼과 목표 타입 뷰 연결
3 participants