-
Notifications
You must be signed in to change notification settings - Fork 1
[Feat-T3-173] 추천 루틴 화면 서버 v2 연동 #52
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -9,6 +9,10 @@ import Domain | |||||||||||||||||||||||||
| import SnapKit | ||||||||||||||||||||||||||
| import UIKit | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| protocol RoutineCardViewDelegate: AnyObject { | ||||||||||||||||||||||||||
| func routineCardView(_ sender: RoutineCardView, didTapPlusButton routine: RecommendedRoutine) | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| final class RoutineCardView: UIView { | ||||||||||||||||||||||||||
| private enum Layout { | ||||||||||||||||||||||||||
| static let horizontalMargin: CGFloat = 16 | ||||||||||||||||||||||||||
|
|
@@ -29,7 +33,7 @@ final class RoutineCardView: UIView { | |||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| private let headerInfoStackView = UIStackView() | ||||||||||||||||||||||||||
| private let categoryIconView = RoutineCategoryIcon(routineCategory: .connection) | ||||||||||||||||||||||||||
| private lazy var categoryIconView = RoutineCategoryIcon(routineCategory: routine.routineType) | ||||||||||||||||||||||||||
| private let titleLabel = UILabel() | ||||||||||||||||||||||||||
| private let editButton = UIButton() | ||||||||||||||||||||||||||
| private let deleteButton = UIButton() | ||||||||||||||||||||||||||
|
|
@@ -38,7 +42,10 @@ final class RoutineCardView: UIView { | |||||||||||||||||||||||||
| private let subRoutineLabel = UILabel() | ||||||||||||||||||||||||||
| private let subRoutineStackView = UIStackView() | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| init() { | ||||||||||||||||||||||||||
| private let routine: RecommendedRoutine | ||||||||||||||||||||||||||
| weak var delegate: RoutineCardViewDelegate? | ||||||||||||||||||||||||||
| init(routine: RecommendedRoutine) { | ||||||||||||||||||||||||||
| self.routine = routine | ||||||||||||||||||||||||||
| super.init(frame: .zero) | ||||||||||||||||||||||||||
| configureAttribute() | ||||||||||||||||||||||||||
| configureLayout() | ||||||||||||||||||||||||||
|
|
@@ -56,14 +63,19 @@ final class RoutineCardView: UIView { | |||||||||||||||||||||||||
| headerInfoStackView.axis = .horizontal | ||||||||||||||||||||||||||
| headerInfoStackView.spacing = Layout.headerInfoStackViewSpacing | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| titleLabel.text = "개운하게 일어나기" | ||||||||||||||||||||||||||
| titleLabel.text = routine.mainTitle | ||||||||||||||||||||||||||
| titleLabel.font = BitnagilFont(style: .body1, weight: .semiBold).font | ||||||||||||||||||||||||||
| titleLabel.textColor = BitnagilColor.gray10 | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| let plusImage = BitnagilIcon.plusIcon? | ||||||||||||||||||||||||||
| .resizeAspectFit(to: CGSize(width: Layout.plusImageSize, height: Layout.plusImageSize)) | ||||||||||||||||||||||||||
| plusButton.setImage(plusImage, for: .normal) | ||||||||||||||||||||||||||
| plusButton.tintColor = BitnagilColor.gray10 | ||||||||||||||||||||||||||
| plusButton.addAction( | ||||||||||||||||||||||||||
| UIAction { [weak self] _ in | ||||||||||||||||||||||||||
| guard let self else { return } | ||||||||||||||||||||||||||
| delegate?.routineCardView(self, didTapPlusButton: routine) | ||||||||||||||||||||||||||
| }, for: .touchUpInside) | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
|
Comment on lines
+74
to
79
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 컴파일 오류: 클로저 내부에서 self 명시 및 프로퍼티 접근자 누락 클로저 내부에서 아래와 같이 수정해주세요. - plusButton.addAction(
- UIAction { [weak self] _ in
- guard let self else { return }
- delegate?.routineCardView(self, didTapPlusButton: routine)
- }, for: .touchUpInside)
+ plusButton.addAction(
+ UIAction { [weak self] _ in
+ guard let self = self else { return }
+ self.delegate?.routineCardView(self, didTapPlusButton: self.routine)
+ },
+ for: .touchUpInside
+ )📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||
| grayLine.backgroundColor = BitnagilColor.gray97 | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
|
|
@@ -78,7 +90,7 @@ final class RoutineCardView: UIView { | |||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
| subRoutineStackView.addArrangedSubview(subRoutineLabel) | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| ["물 마시기", "물 마시기", "물 마시기"].forEach { | ||||||||||||||||||||||||||
| routine.subRoutines.forEach { | ||||||||||||||||||||||||||
| let subRoutineTitleLabel = UILabel() | ||||||||||||||||||||||||||
| subRoutineTitleLabel.text = "• \($0)" | ||||||||||||||||||||||||||
| subRoutineTitleLabel.font = BitnagilFont(style: .body2, weight: .medium).font | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
This file was deleted.
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.
새로 수정된 코드에서 이
categoryIconView관련 코드를 찾아볼 수 없었는데요! 혹시 lazy var로 설정해주신 이유를 알 수 있을까요?!?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.
RoutineCardView에서만CategoryIconView를 사용할 것 같아서 같은 파일 내부에 fileprivate으로 구현해두었습니다 !!!그리고
RoutineCardView의 생성자로 들어온 routine의 카테고리 값으로 초기화 해야 해가주구 lazy var로 설정했습니다 !!!