diff --git a/Cherrish-iOS/Cherrish-iOS/Data/Network/EndPoint/OnboardingAPI.swift b/Cherrish-iOS/Cherrish-iOS/Data/Network/EndPoint/OnboardingAPI.swift index 79a3c077..0986c70c 100644 --- a/Cherrish-iOS/Cherrish-iOS/Data/Network/EndPoint/OnboardingAPI.swift +++ b/Cherrish-iOS/Cherrish-iOS/Data/Network/EndPoint/OnboardingAPI.swift @@ -41,7 +41,7 @@ enum OnboardingAPI: EndPoint { return JSONEncoding.default } - var queryParameters: [String: String]? { + var queryParameters: [String: Any]? { return nil } diff --git a/Cherrish-iOS/Cherrish-iOS/Presentation/Feature/Onboarding/InformationView.swift b/Cherrish-iOS/Cherrish-iOS/Presentation/Feature/Onboarding/InformationView.swift index fdaf73b9..3f973fcc 100644 --- a/Cherrish-iOS/Cherrish-iOS/Presentation/Feature/Onboarding/InformationView.swift +++ b/Cherrish-iOS/Cherrish-iOS/Presentation/Feature/Onboarding/InformationView.swift @@ -23,8 +23,13 @@ struct InformationView: View { name.count > 7 } + private var ageNumericValue: Int? { + let numericString = age.replacingOccurrences(of: " 세", with: "") + return Int(numericString) + } + private var isAgeOverLimit: Bool { - guard let ageValue = Int(age) else { return false } + guard let ageValue = ageNumericValue else { return false } return ageValue > 100 } @@ -54,10 +59,10 @@ struct InformationView: View { .offset(y: 24.adjustedH) } } - .padding(.top, 70.adjustedH) + .padding(.top, 70.adjustedH) .padding(.horizontal, 34.adjustedW) - CherrishTextBox(title: "나이",text: $age, placeholder: "20", isNumberField: true) + CherrishTextBox(title: "나이",text: $age, placeholder: "20 세", isNumberField: true) .focused($isAgeFocused) .overlay(alignment: .bottomLeading) { if showAgeError { @@ -78,7 +83,7 @@ struct InformationView: View { trailingIcon: nil ) { Task { - guard let ageValue = Int(age) else { return } + guard let ageValue = ageNumericValue else { return } await viewModel.createProfile(name: name, age: ageValue) } } @@ -95,6 +100,9 @@ struct InformationView: View { .onChange(of: age) { _ in updateButtonState() } .onChange(of: isAgeFocused) { focused in if !focused { + if let numericValue = ageNumericValue, !age.hasSuffix(" 세") { + age = "\(numericValue) 세" + } showAgeError = isAgeOverLimit } } diff --git a/Cherrish-iOS/Cherrish-iOS/Presentation/Global/Components/CherrishTextField/CherrishTextField.swift b/Cherrish-iOS/Cherrish-iOS/Presentation/Global/Components/CherrishTextField/CherrishTextField.swift index a641fc67..d541074c 100644 --- a/Cherrish-iOS/Cherrish-iOS/Presentation/Global/Components/CherrishTextField/CherrishTextField.swift +++ b/Cherrish-iOS/Cherrish-iOS/Presentation/Global/Components/CherrishTextField/CherrishTextField.swift @@ -79,7 +79,7 @@ enum CherrishTextFieldStyle { case .plain, .number: return 16.adjustedW case .date: - return 18.5.adjustedW + return 0 } } @@ -158,6 +158,7 @@ struct CherrishTextField: View { .tint(style.textColor) } .frame(height: style.fontHeight) + .padding(.horizontal, style.horizontalPadding) } .padding(.vertical, style.verticalPadding) .background {