From 9e84389fb525dd7af4f8cc1c90c94ffe6e89972f Mon Sep 17 00:00:00 2001 From: otoolz Date: Sat, 13 Jan 2024 05:18:02 +0900 Subject: [PATCH 1/3] =?UTF-8?q?chore=20#394:=20TLToastView=20Layout=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- iOS/traveline/Sources/DesignSystem/View/TLToastView.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iOS/traveline/Sources/DesignSystem/View/TLToastView.swift b/iOS/traveline/Sources/DesignSystem/View/TLToastView.swift index 4eca813..1b5e282 100644 --- a/iOS/traveline/Sources/DesignSystem/View/TLToastView.swift +++ b/iOS/traveline/Sources/DesignSystem/View/TLToastView.swift @@ -65,7 +65,7 @@ final class TLToastView: UIView { translatesAutoresizingMaskIntoConstraints = false alpha = 1.0 NSLayoutConstraint.activate([ - bottomAnchor.constraint(equalTo: view.bottomAnchor, constant: -24), + bottomAnchor.constraint(equalTo: view.keyboardLayoutGuide.topAnchor, constant: -24), leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: Metric.margin), trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: -Metric.margin), heightAnchor.constraint(equalToConstant: Metric.toastHeight) From e2afd474f3d7ada7f1a1a5876fef66121a5929e4 Mon Sep 17 00:00:00 2001 From: otoolz Date: Sat, 13 Jan 2024 05:20:09 +0900 Subject: [PATCH 2/3] =?UTF-8?q?feat=20#394:=20=EC=97=AC=ED=96=89=20?= =?UTF-8?q?=EC=83=9D=EC=84=B1=20=EC=A0=9C=EB=AA=A9=20=EA=B8=80=EC=9E=90?= =?UTF-8?q?=EC=88=98=20=EC=A0=9C=ED=95=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TravelFeature/TravelScene/VC/TravelVC.swift | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/iOS/traveline/Sources/Feature/TravelFeature/TravelScene/VC/TravelVC.swift b/iOS/traveline/Sources/Feature/TravelFeature/TravelScene/VC/TravelVC.swift index 7a87e20..9a6d580 100644 --- a/iOS/traveline/Sources/Feature/TravelFeature/TravelScene/VC/TravelVC.swift +++ b/iOS/traveline/Sources/Feature/TravelFeature/TravelScene/VC/TravelVC.swift @@ -20,6 +20,8 @@ final class TravelVC: UIViewController { } private enum Constants { + static let titleLimit: Int = 14 + static let titleLimitToastMessage = "제목은 1 - 14자 이내만 가능합니다." static let title: String = "여행 생성" static let textFieldPlaceholder: String = "제목 *" static let done: String = "완료" @@ -144,6 +146,7 @@ final class TravelVC: UIViewController { private extension TravelVC { func setupAttributes() { + view.keyboardLayoutGuide.followsUndockedKeyboard = true view.backgroundColor = TLColor.black titleTextField.placeholder = Constants.textFieldPlaceholder baseScrollView.delegate = self @@ -354,6 +357,14 @@ extension TravelVC: UITextFieldDelegate { dismissKeyboard() return true } + + func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool { + let text = textField.text ?? "" + if text.count + string.count > Constants.titleLimit { + return false + } + return true + } } // MARK: - TLBottomSheetDelegate From 7bf9a3a54e0251457fdff8d9dde50396dff7c982 Mon Sep 17 00:00:00 2001 From: otoolz Date: Sat, 13 Jan 2024 05:22:04 +0900 Subject: [PATCH 3/3] =?UTF-8?q?feat=20#394:=20toast=20view=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Sources/Feature/TravelFeature/TravelScene/VC/TravelVC.swift | 2 ++ 1 file changed, 2 insertions(+) diff --git a/iOS/traveline/Sources/Feature/TravelFeature/TravelScene/VC/TravelVC.swift b/iOS/traveline/Sources/Feature/TravelFeature/TravelScene/VC/TravelVC.swift index 9a6d580..36881e8 100644 --- a/iOS/traveline/Sources/Feature/TravelFeature/TravelScene/VC/TravelVC.swift +++ b/iOS/traveline/Sources/Feature/TravelFeature/TravelScene/VC/TravelVC.swift @@ -361,6 +361,8 @@ extension TravelVC: UITextFieldDelegate { func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool { let text = textField.text ?? "" if text.count + string.count > Constants.titleLimit { + let textLimitToast = TLToastView(type: .failure, message: Constants.titleLimitToastMessage) + textLimitToast.show(in: self.view) return false } return true