-
Notifications
You must be signed in to change notification settings - Fork 10
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
Conversation
+ feat: PrepareRunViewModel 생성
|
||
protocol PrepareRunViewModelOutputs { | ||
var userLocation: AnyPublisher<CLLocationCoordinate2D, Never> { get } | ||
var goalTypePublisher: Published<GoalType>.Publisher { get } |
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.
이거는 나중에 CurrentValueSubject<GoalType, Never>
로 변경하면 되겠네요
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.
그럼 아래 @published 를 대체하게 되는 건가요?
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.
네 그러면 @published
랑 Published<GoalType>.Publisher
이 둘을 합쳐줄 수 있을 것 같아요
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 | ||
}() |
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.
오늘 너무나도 깔끔하게 UIView 코드를 짤 방안이 필요하다고 느끼게된 순간이네요...
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), | ||
]) | ||
} | ||
} |
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.
addSubView와 AutoLayout 로직은 분리하는게 좋겠어요
|
||
protocol PrepareRunViewModelOutputs { | ||
var userLocation: AnyPublisher<CLLocationCoordinate2D, Never> { get } | ||
var goalTypePublisher: Published<GoalType>.Publisher { get } |
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.
그럼 아래 @published 를 대체하게 되는 건가요?
Issue Number
Close #25
변경사항
새로운 기능
기능 목록
MVVM, Combine, 및 Coordinator 패턴을 적용하여 목표 설정 버튼과 GoalTypeView 연결
GoalTypeView를 테이블 뷰로 구현
Custom Cell을 만들어서 GoalTypeView에서 사용
GoalTypeView 에 Header 및 Footer 추가
Footer 에 지우기 버튼 추가
작업 유형
체크리스트