Conversation
📝 WalkthroughWalkthrough세 개의 UI 컴포넌트에서 고정 너비 제약을 제거하고 수평 확장을 허용하도록 레이아웃을 변경했으며, 버튼 타입의 공개 Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
Cherrish-iOS/Cherrish-iOS/Presentation/Global/Components/SelectionChip.swift (1)
10-28: 고려사항: MissionCard와의 스타일 중복
SelectionChip과MissionCard가 동일한 시각적 스타일(높이 80, cornerRadius 10, 동일한 색상 체계)을 공유합니다. 현재는 문제가 되지 않지만, 향후 유지보수성을 위해 공통 스타일을 ViewModifier나 공유 스타일 컴포넌트로 추출하는 것을 고려해볼 수 있습니다.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (3)
Cherrish-iOS/Cherrish-iOS/Presentation/Global/Components/CherrishButton.swiftCherrish-iOS/Cherrish-iOS/Presentation/Global/Components/MissionCard.swiftCherrish-iOS/Cherrish-iOS/Presentation/Global/Components/SelectionChip.swift
🧰 Additional context used
🧬 Code graph analysis (1)
Cherrish-iOS/Cherrish-iOS/Presentation/Global/Components/SelectionChip.swift (1)
Cherrish-iOS/Cherrish-iOS/Presentation/Global/Extension/View+Color.swift (4)
red200(69-71)gray0(9-11)red500(81-83)gray500(29-31)
🔇 Additional comments (3)
Cherrish-iOS/Cherrish-iOS/Presentation/Global/Components/MissionCard.swift (1)
33-33: LGTM!고정 너비(148)를
maxWidth: .infinity로 변경하여 컴포넌트가 사용 가능한 수평 공간을 채울 수 있도록 적절히 수정되었습니다. 높이는 80으로 유지되어 카드의 일관된 세로 크기를 보장합니다.Cherrish-iOS/Cherrish-iOS/Presentation/Global/Components/SelectionChip.swift (1)
19-27: LGTM!고정 너비를
maxWidth: .infinity로 변경하여 MissionCard와 일관된 유연한 레이아웃 방식을 적용했습니다. 높이(80), cornerRadius(10), 색상 로직이 적절히 유지되었습니다.Cherrish-iOS/Cherrish-iOS/Presentation/Global/Components/CherrishButton.swift (1)
46-55: LGTM!타입별 고정 너비를 제거하고
maxWidth: .infinity로 변경하여 버튼이 가용 공간을 채우도록 적절히 리팩터링되었습니다. 타입별 높이(.save: 44, 기본값: 50)와 cornerRadius(.save: 10, 기본값: 12)는 유지되어 각 버튼 유형의 시각적 특성을 보존하며, isPressed 상태의 애니메이션(0.95 배수)도 일관되게 적용됩니다.이 버튼 컴포넌트가 실제 뷰에 통합될 때 상위 컨테이너에서 적절한 padding이나 frame 제약을 통해 버튼 너비가 올바르게 제어되는지 확인하세요.
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Fix all issues with AI agents
In
@Cherrish-iOS/Cherrish-iOS/Presentation/Global/Components/CherrishButton.swift:
- Around line 111-172: In CherrishButtonPreviewWrapper replace the explicit
CGFloat initializer used in the padding modifier (currently written as
CGFloat(8) on the CherrishButton instance) with a plain numeric literal (8) so
Swift infers the type; update the padding call on the second CherrishButton (the
one with comment "// NEXT - 활성") to use .padding(8) instead of
.padding(CGFloat(8)).
- Around line 50-58: In makeBody(configuration:), remove the redundant
cornerRadius scaling so the pressed visual is driven by scaleEffect only: keep
scaleEffect(configuration.isPressed ? 0.95 : 1.0) and change the
clipShape(RoundedRectangle(...)) to always use type.cornerRadius (do not
multiply by 0.95 when configuration.isPressed); this removes the double-shrink
effect when Configuration.isPressed while preserving the existing press
animation.
In
@Cherrish-iOS/Cherrish-iOS/Presentation/Global/Components/SelectionChip.swift:
- Around line 19-25: The background color is applied as a rectangle so its
corners stay square while the overlay stroke is rounded; update the background
to use a rounded shape filled with the conditional color (e.g., replace
.background(isSelected ? .red200 : .gray0) with a RoundedRectangle(cornerRadius:
10).fill(isSelected ? .red200 : .gray0)) so the fill matches the overlay stroke;
ensure you keep the existing overlay RoundedRectangle(cornerRadius:
10).stroke(...) and the frame modifiers intact to preserve sizing and selection
logic in SelectionChip.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (3)
Cherrish-iOS/Cherrish-iOS/Presentation/Global/Components/CherrishButton.swiftCherrish-iOS/Cherrish-iOS/Presentation/Global/Components/MissionCard.swiftCherrish-iOS/Cherrish-iOS/Presentation/Global/Components/SelectionChip.swift
🧰 Additional context used
🧬 Code graph analysis (2)
Cherrish-iOS/Cherrish-iOS/Presentation/Global/Components/SelectionChip.swift (1)
Cherrish-iOS/Cherrish-iOS/Presentation/Global/Extension/View+Color.swift (4)
red200(69-71)gray0(9-11)red500(81-83)gray500(29-31)
Cherrish-iOS/Cherrish-iOS/Presentation/Global/Components/CherrishButton.swift (3)
Cherrish-iOS/Cherrish-iOS/Presentation/Global/Extension/Font+.swift (1)
typography(60-65)Cherrish-iOS/Cherrish-iOS/Presentation/Global/Extension/View+Shadow.swift (1)
body(9-17)Cherrish-iOS/Cherrish-iOS/Presentation/Global/Extension/View+Color.swift (1)
gray100(13-15)
🔇 Additional comments (3)
Cherrish-iOS/Cherrish-iOS/Presentation/Global/Components/MissionCard.swift (1)
33-34: LGTM!고정 너비를 제거하고
maxWidth: .infinity를 사용하여 유연한 너비를 적용한 변경이 PR 목표에 부합합니다. 높이는 80으로 유지되어 일관된 레이아웃을 보장합니다.Cherrish-iOS/Cherrish-iOS/Presentation/Global/Components/SelectionChip.swift (1)
26-28: LGTM!탭 제스처 처리가 올바르게 구현되어 있습니다.
Cherrish-iOS/Cherrish-iOS/Presentation/Global/Components/CherrishButton.swift (1)
31-37: LGTM!
HStack과Spacer를 사용하여 버튼 텍스트를 중앙 정렬하는 방식이 유연한 너비와 함께 잘 작동합니다.
| func makeBody(configuration: Configuration) -> some View { | ||
| configuration.label | ||
| .frame( | ||
| width: configuration.isPressed ? type.width * 0.95 : type.width, | ||
| height: configuration.isPressed ? type.height * 0.95 : type.height | ||
| ) | ||
| .frame(height: type.height) | ||
| .background(type.backgroundColor(for: state)) | ||
| .clipShape(RoundedRectangle(cornerRadius: configuration.isPressed | ||
| ? type.cornerRadius * 0.95 | ||
| : type.cornerRadius)) | ||
| .scaleEffect(configuration.isPressed ? 0.95 : 1.0) | ||
| } |
There was a problem hiding this comment.
🧹 Nitpick | 🔵 Trivial
scaleEffect와 cornerRadius 조정의 중복 가능성을 검토하세요.
scaleEffect(0.95)는 전체 뷰를 축소하므로 cornerRadius도 시각적으로 비례하여 줄어듭니다. 여기에 cornerRadius * 0.95를 추가로 적용하면 모서리가 의도한 것보다 더 날카롭게 보일 수 있습니다.
♻️ cornerRadius 조정 제거 제안
func makeBody(configuration: Configuration) -> some View {
configuration.label
.frame(height: type.height)
.background(type.backgroundColor(for: state))
- .clipShape(RoundedRectangle(cornerRadius: configuration.isPressed
- ? type.cornerRadius * 0.95
- : type.cornerRadius))
+ .clipShape(RoundedRectangle(cornerRadius: type.cornerRadius))
.scaleEffect(configuration.isPressed ? 0.95 : 1.0)
}🤖 Prompt for AI Agents
In
@Cherrish-iOS/Cherrish-iOS/Presentation/Global/Components/CherrishButton.swift
around lines 50 - 58, In makeBody(configuration:), remove the redundant
cornerRadius scaling so the pressed visual is driven by scaleEffect only: keep
scaleEffect(configuration.isPressed ? 0.95 : 1.0) and change the
clipShape(RoundedRectangle(...)) to always use type.cornerRadius (do not
multiply by 0.95 when configuration.isPressed); this removes the double-shrink
effect when Configuration.isPressed while preserving the existing press
animation.
| struct CherrishButtonPreviewWrapper: View { | ||
|
|
||
| @State private var nextState: ButtonState = .normal | ||
| @State private var activeNextState: ButtonState = .active | ||
| @State private var dummyState: ButtonState = .active | ||
|
|
||
| var body: some View { | ||
| VStack(spacing: 16) { | ||
|
|
||
| // NEXT - 비활성 | ||
| CherrishButton( | ||
| title: "다음", | ||
| type: .next, | ||
| state: $nextState | ||
| ) { | ||
| print("Next (normal)") | ||
| } | ||
|
|
||
| // NEXT - 활성 | ||
| CherrishButton( | ||
| title: "다음", | ||
| type: .next, | ||
| state: $activeNextState | ||
| ) { | ||
| print("Next (active)") | ||
| } | ||
| .padding(CGFloat(8)) | ||
|
|
||
| // CONFIRM | ||
| CherrishButton( | ||
| title: "확인", | ||
| type: .confirm, | ||
| state: $dummyState | ||
| ) { | ||
| print("Confirm") | ||
| } | ||
|
|
||
| // SAVE | ||
| CherrishButton( | ||
| title: "등록하기", | ||
| type: .save, | ||
| state: $dummyState | ||
| ) { | ||
| print("Save") | ||
| } | ||
|
|
||
| // ADD EVENT | ||
| CherrishButton( | ||
| title: "다운타임 없이 일정 추가", | ||
| type: .addEvent, | ||
| state: $dummyState | ||
| ) { | ||
| print("Add Event") | ||
| } | ||
| } | ||
| .padding() | ||
| .background(Color.gray100) | ||
| } | ||
| } | ||
| #Preview { | ||
| CherrishButtonPreviewWrapper() | ||
| } |
There was a problem hiding this comment.
🧹 Nitpick | 🔵 Trivial
프리뷰 래퍼 추가가 좋습니다.
모든 버튼 타입과 상태를 테스트할 수 있는 프리뷰 래퍼가 개발에 유용합니다. 다만 Line 137의 CGFloat(8)은 단순히 8로 작성해도 Swift가 자동으로 타입을 추론합니다.
🤖 Prompt for AI Agents
In
@Cherrish-iOS/Cherrish-iOS/Presentation/Global/Components/CherrishButton.swift
around lines 111 - 172, In CherrishButtonPreviewWrapper replace the explicit
CGFloat initializer used in the padding modifier (currently written as
CGFloat(8) on the CherrishButton instance) with a plain numeric literal (8) so
Swift infers the type; update the padding call on the second CherrishButton (the
one with comment "// NEXT - 활성") to use .padding(8) instead of
.padding(CGFloat(8)).
| .frame(maxWidth: .infinity) | ||
| .frame(height: 80) | ||
| .background(isSelected ? .red200 : .gray0) | ||
| .overlay( | ||
| RoundedRectangle(cornerRadius: 10) | ||
| .stroke(isSelected ? .red500 : .gray500, lineWidth: 1) | ||
| ) |
There was a problem hiding this comment.
배경 색상에 라운드 처리가 누락되었습니다.
.background() 수정자는 색상을 직사각형으로 채우므로 배경의 모서리가 둥글게 표시되지 않습니다. overlay의 RoundedRectangle stroke는 테두리만 둥글게 처리하고 배경은 그대로 둡니다.
🔧 배경에 라운드 처리를 적용하는 수정안
.frame(maxWidth: .infinity)
.frame(height: 80)
- .background(isSelected ? .red200 : .gray0)
+ .background(
+ RoundedRectangle(cornerRadius: 10)
+ .fill(isSelected ? .red200 : .gray0)
+ )
.overlay(
RoundedRectangle(cornerRadius: 10)
.stroke(isSelected ? .red500 : .gray500, lineWidth: 1)
)🤖 Prompt for AI Agents
In @Cherrish-iOS/Cherrish-iOS/Presentation/Global/Components/SelectionChip.swift
around lines 19 - 25, The background color is applied as a rectangle so its
corners stay square while the overlay stroke is rounded; update the background
to use a rounded shape filled with the conditional color (e.g., replace
.background(isSelected ? .red200 : .gray0) with a RoundedRectangle(cornerRadius:
10).fill(isSelected ? .red200 : .gray0)) so the fill matches the overlay stroke;
ensure you keep the existing overlay RoundedRectangle(cornerRadius:
10).stroke(...) and the frame modifiers intact to preserve sizing and selection
logic in SelectionChip.
| .clipShape(RoundedRectangle(cornerRadius: configuration.isPressed | ||
| ? type.cornerRadius * 0.95 | ||
| : type.cornerRadius)) | ||
| .scaleEffect(configuration.isPressed ? 0.95 : 1.0) |
| } | ||
|
|
||
|
|
||
| struct CherrishButtonPreviewWrapper: View { |
| .clipShape(RoundedRectangle(cornerRadius: configuration.isPressed | ||
| ? type.cornerRadius * 0.95 | ||
| : type.cornerRadius)) | ||
| .scaleEffect(configuration.isPressed ? 0.95 : 1.0) |

🔗 연결된 이슈
📄 작업 내용