Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
//
// AgeTextBox.swift
// Cherrish-iOS
//
// Created by 어재선 on 1/13/26.
//
Comment on lines +1 to +6
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

파일 헤더의 파일명과 실제 struct 이름 불일치

헤더에는 AgeTextBox.swift로 되어 있지만 실제 struct 이름은 CherrishTextBox입니다.

🔧 수정 제안
 //
-//  AgeTextBox.swift
+//  CherrishTextBox.swift
 //  Cherrish-iOS
 //
 //  Created by 어재선 on 1/13/26.
 //
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
//
// AgeTextBox.swift
// Cherrish-iOS
//
// Created by 어재선 on 1/13/26.
//
//
// CherrishTextBox.swift
// Cherrish-iOS
//
// Created by 어재선 on 1/13/26.
//
🤖 Prompt for AI Agents
In
`@Cherrish-iOS/Cherrish-iOS/Presentation/Global/Components/CherrishTextBox/CherrishTextBox.swift`
around lines 1 - 6, Header filename and actual struct name mismatch: the top
comment shows "AgeTextBox.swift" while the struct is CherrishTextBox. Fix by
either renaming the file header to "CherrishTextBox.swift" (update the top
comment block) to match the struct CherrishTextBox, or if the intent was an
AgeTextBox type, rename the struct CherrishTextBox to AgeTextBox (and update any
references). Locate the comment block at the top of the file and the struct
declaration named CherrishTextBox to apply the change consistently.


import SwiftUI

struct CherrishTextBox: View {
var title: String
@Binding var text: String
let placeholder: String

var body: some View {
VStack(spacing: 0) {
HStack(spacing: 0) {
TypographyText(title, style: .body1_sb_14,color: .gray1000)
Spacer()
}
Spacer()
.frame(height: 8.adjustedH)
Comment on lines +21 to +22
Copy link

Choose a reason for hiding this comment

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

🧹 Nitpick | 🔵 Trivial

Spacer().frame(height:) 대신 VStack spacing 활용 고려

현재 Spacer().frame(height: 8.adjustedH)를 사용하고 있지만, VStack의 spacing을 8.adjustedH로 설정하면 더 간결해집니다.

♻️ 제안 코드
-        VStack(spacing: 0) {
+        VStack(spacing: 8.adjustedH) {
             HStack(spacing: 0) {
                 TypographyText("나이", style: .body1_sb_14,color: .gray1000)
                 Spacer()
             }
-            Spacer()
-                .frame(height: 8.adjustedH)
             AgeTextField(text: $text, placeholder: placeholder)
         }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
Spacer()
.frame(height: 8.adjustedH)
VStack(spacing: 8.adjustedH) {
HStack(spacing: 0) {
TypographyText("나이", style: .body1_sb_14,color: .gray1000)
Spacer()
}
AgeTextField(text: $text, placeholder: placeholder)
}
🤖 Prompt for AI Agents
In
@Cherrish-iOS/Cherrish-iOS/Presentation/Global/Components/CherrishTextBox/AgeTextBox.swift
around lines 20 - 21, Replace the explicit vertical spacer
Spacer().frame(height: 8.adjustedH) with the VStack's spacing parameter: remove
the Spacer().frame(...) call and set the parent VStack (the one containing
AgeTextBox elements) to spacing: 8.adjustedH so layout is handled by the stack;
update any VStack initializers that wrap the affected views (look for usages of
VStack { ... } around AgeTextBox and the Spacer()) to include spacing and remove
the explicit Spacer() line.

CherrishTextField(text: $text, style: .plain(placeholder: placeholder))
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
//
// DateTextBox.swift
// Cherrish-iOS
//
// Created by 어재선 on 1/13/26.
//

import SwiftUI

struct DateTextBox: View {
@Binding var year: String
@Binding var month: String
@Binding var day: String

var body: some View {
VStack(spacing: 8) {
HStack(spacing: 0) {
TypographyText("날짜", style: .body1_sb_14, color: .gray1000)
Spacer()
}
HStack{
DateLabel(text: $year, placeholderStyle: .year)
DateLabel(text: $month, placeholderStyle: .month)
DateLabel(text: $day, placeholderStyle: .day)
}
Comment on lines +21 to +25
Copy link

Choose a reason for hiding this comment

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

🧹 Nitpick | 🔵 Trivial

HStack spacing 명시적 지정 권장

Line 19의 HStack(spacing: 0)과 달리 Line 23의 HStack은 spacing이 지정되어 있지 않습니다. 의도적으로 기본 spacing을 사용하는 것이라면 괜찮지만, 명시적으로 지정하면 레이아웃 의도가 더 명확해집니다.

🤖 Prompt for AI Agents
In
@Cherrish-iOS/Cherrish-iOS/Presentation/Global/Components/CherrishTextBox/DateTextBox.swift
around lines 23 - 27, The HStack containing the three DateLabel views currently
omits an explicit spacing value; update that HStack to specify the intended
spacing (e.g., HStack(spacing: 0)) to match the earlier HStack usage and make
layout intent explicit so DateLabel(text: $year, ...), DateLabel(text: $month,
...), and DateLabel(text: $day, ...) render with the correct spacing.

}
}
}

private struct DateLabel: View {
@Binding var text: String
let placeholderStyle: DateTextFieldStyle
var body: some View {
HStack {
CherrishTextField(
text: $text,
style: .date(
placeholder: placeholderStyle
)
)
TypographyText(
placeholderStyle.kr,
style: .title2_m_16,
color: .gray700
)
}
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
//
// AgeTextField.swift
// Cherrish-iOS
//
// Created by 어재선 on 1/13/26.
//
Comment on lines +1 to +6
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

파일 헤더의 파일명과 실제 struct 이름 불일치

헤더에는 AgeTextField.swift로 되어 있지만 실제 struct 이름은 CherrishTextField입니다. 파일명 변경 시 헤더 주석도 함께 업데이트가 필요합니다.

🔧 수정 제안
 //
-//  AgeTextField.swift
+//  CherrishTextField.swift
 //  Cherrish-iOS
 //
 //  Created by 어재선 on 1/13/26.
 //
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
//
// AgeTextField.swift
// Cherrish-iOS
//
// Created by 어재선 on 1/13/26.
//
//
// CherrishTextField.swift
// Cherrish-iOS
//
// Created by 어재선 on 1/13/26.
//
🤖 Prompt for AI Agents
In
`@Cherrish-iOS/Cherrish-iOS/Presentation/Global/Components/CherrishTextField/CherrishTextField.swift`
around lines 1 - 6, The file header comment lists "AgeTextField.swift" but the
struct defined is CherrishTextField; update the header comment to match the
actual file/struct name (e.g., change the header to "CherrishTextField.swift")
or rename the struct to match the intended filename—ensure consistency between
the header filename and the struct name CherrishTextField so they match exactly.


import SwiftUI

enum CherrishTextFieldStyle {

case plain(placeholder: String)
case date(placeholder: DateTextFieldStyle)

var placeholder: String {
switch self {
case .plain(placeholder: let placeholder):
return placeholder
case .date(placeholder: let placeholder):
return placeholder.rawValue
}
}

var placeholderFont: Typography {
switch self {
case .plain:
return .body1_r_14
case .date:
return .title2_r_16
}
}

var placeholderColor: Color {
switch self {
case .plain:
return .gray600
case .date:
return .gray500
}
}

var textFont: Typography {
switch self {
case .plain:
return .body1_m_14
case .date:
return .title2_m_16
}
}

var textColor: Color {
switch self {
default:
return .gray1000
}
}

var fontHeight: CGFloat {
switch self {
default:
return 24.adjustedH
}
}
Comment on lines +51 to +63
Copy link

Choose a reason for hiding this comment

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

🧹 Nitpick | 🔵 Trivial

default만 있는 switch문 단순화 가능

textColor, fontHeight 등 현재 모든 케이스에서 동일한 값을 반환하는 프로퍼티들은 switch 없이 직접 값을 반환하면 더 간결해집니다.

♻️ 제안 코드
     var textColor: Color {
-        switch self {
-        default:
-            return .gray1000
-        }
+        .gray1000
     }
     
     var fontHeight: CGFloat {
-        switch self {
-        default:
-            return 24.adjustedH
-        }
+        24.adjustedH
     }

향후 스타일별 분기가 필요해지면 다시 switch로 변경하면 됩니다.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
var textColor: Color {
switch self {
default:
return .gray1000
}
}
var fontHeight: CGFloat {
switch self {
default:
return 24.adjustedH
}
}
var textColor: Color {
.gray1000
}
var fontHeight: CGFloat {
24.adjustedH
}
🤖 Prompt for AI Agents
In
`@Cherrish-iOS/Cherrish-iOS/Presentation/Global/Components/CherrishTextField/CherrishTextField.swift`
around lines 51 - 63, The properties textColor and fontHeight currently use
redundant switch statements with only a default branch; replace each switch by
returning the constant directly (e.g., have textColor return .gray1000 and
fontHeight return 24.adjustedH) and remove the unused switch blocks in
CherrishTextField (keep the property names textColor and fontHeight unchanged);
if you later need per-style branching, reintroduce a switch in these properties.


var horizontalPadding: CGFloat {
switch self {
case .plain:
return 16.adjustedW
case .date:
return 18.5.adjustedW
}
}

var verticalPadding: CGFloat {
switch self {
case .plain:
return 10.adjustedH
case .date:
return 8.adjustedH
}
}

var backgroundStrokeColor: Color {
switch self {
default:
return .gray500
}
}
Comment on lines +83 to +88
Copy link

Choose a reason for hiding this comment

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

🧹 Nitpick | 🔵 Trivial

backgroundStrokeColor도 동일하게 단순화 가능합니다.

Lines 51-63과 동일한 패턴으로, default만 있는 switch문입니다.

♻️ 수정 제안
     var backgroundStrokeColor: Color {
-        switch self {
-        default:
-            return .gray500
-        }
+        .gray500
     }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
var backgroundStrokeColor: Color {
switch self {
default:
return .gray500
}
}
var backgroundStrokeColor: Color {
.gray500
}
🤖 Prompt for AI Agents
In
`@Cherrish-iOS/Cherrish-iOS/Presentation/Global/Components/CherrishTextField/CherrishTextField.swift`
around lines 83 - 88, The computed property backgroundStrokeColor currently uses
a switch with only a default case; simplify it the same way as the earlier
property (lines 51-63) by removing the switch and directly returning .gray500
from backgroundStrokeColor to make the code concise and clear.


var textAlinement: TextAlignment {
switch self {
case .plain:
return .leading
case .date:
return .center
}
}
Comment on lines +90 to +97
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

오타 수정 필요: textAlinementtextAlignment

프로퍼티명에 오타가 있습니다. Alinement가 아닌 Alignment가 올바른 철자입니다.

🔧 수정 제안
-    var textAlinement: TextAlignment {
+    var textAlignment: TextAlignment {

Line 144도 함께 수정:

-                    .multilineTextAlignment(style.textAlinement)
+                    .multilineTextAlignment(style.textAlignment)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
var textAlinement: TextAlignment {
switch self {
case .plain:
return .leading
case .date:
return .center
}
}
var textAlignment: TextAlignment {
switch self {
case .plain:
return .leading
case .date:
return .center
}
}
🤖 Prompt for AI Agents
In
`@Cherrish-iOS/Cherrish-iOS/Presentation/Global/Components/CherrishTextField/CherrishTextField.swift`
around lines 90 - 97, Rename the misspelled property textAlinement to
textAlignment across the CherrishTextField type: update the computed property
declaration (currently var textAlinement: TextAlignment { ... }) to var
textAlignment: TextAlignment { ... } and adjust the switch cases unchanged; then
refactor every usage/site that references textAlinement (including the other
occurrence noted around the second block/line mentioned in the review) to the
new textAlignment name so all calls, bindings, and previews compile and the
spelling is consistent.

}

enum DateTextFieldStyle: String {
case year = "YYYY"
case month = "MM"
case day = "DD"

var kr: String {
switch self {
case .year:
"년"
case .month:
"월"
case .day:
"일"
}
}
}


struct CherrishTextField: View {
@Binding var text: String
let style: CherrishTextFieldStyle
var body: some View {

HStack(spacing: 0){
ZStack {
if text.isEmpty {
HStack{
switch style {
case .plain:
EmptyView()
case .date:
Spacer()
}
TypographyText(
style.placeholder,
style: style.placeholderFont ,
color: style.placeholderColor
)
Spacer()
}
}
TextField("" ,text: $text)
.foregroundStyle(style.textColor)
.multilineTextAlignment(style.textAlinement)
.keyboardType(.numberPad)
.typography(style.textFont)
.tint(style.textColor)
Comment on lines +141 to +146
Copy link

Choose a reason for hiding this comment

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

🧹 Nitpick | 🔵 Trivial

코드 포맷팅 개선 및 키보드 타입 하드코딩

  1. Line 141에서 쉼표 뒤에 공백이 누락되어 있습니다.
  2. .numberPad가 하드코딩되어 있어 향후 일반 텍스트 입력에 재사용할 때 제약이 됩니다.
♻️ 포맷팅 수정 제안
-                TextField("" ,text: $text)
+                TextField("", text: $text)
🤖 Prompt for AI Agents
In
`@Cherrish-iOS/Cherrish-iOS/Presentation/Global/Components/CherrishTextField/CherrishTextField.swift`
around lines 141 - 146, The TextField call has a missing space after the opening
string comma and hardcodes .keyboardType(.numberPad); fix the formatting by
adding the space so it reads TextField("", text: $text) and make the keyboard
type configurable by replacing .keyboardType(.numberPad) with
.keyboardType(keyboardType) (or a similarly named property) on the
CherrishTextField component, add a keyboardType property with a sensible default
(e.g., .numberPad) to the component's initializer/state so callers can override
it for general text input, and update any initializers/usages to pass the
desired keyboard type.

}
.frame(height: style.fontHeight)
}
.padding(.horizontal, style.horizontalPadding)
.padding(.vertical, style.verticalPadding)
.background {
RoundedRectangle(cornerRadius: 10)
.stroke(style.backgroundStrokeColor, lineWidth: 1)
}
.frame(height: 44)
}
}