From 9db00f0518d369f9d6bfebcae2ac238cd47193db Mon Sep 17 00:00:00 2001 From: J0onYEong Date: Tue, 24 Sep 2024 14:52:26 +0900 Subject: [PATCH 1/5] =?UTF-8?q?[IDLE-000]=20=EC=95=B1=EB=82=B4=20=EC=82=AC?= =?UTF-8?q?=EC=9A=A9=EC=9E=90=20=EC=B6=94=EC=A0=81=ED=97=88=EC=9A=A9?= =?UTF-8?q?=EC=9A=94=EC=B2=AD=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ProjectDescriptionHelpers/InfoPlist.swift | 5 +- .../Projects/App/Sources/AppDelegate.swift | 54 +++++++++---------- 2 files changed, 28 insertions(+), 31 deletions(-) diff --git a/project/Plugins/ConfigurationPlugin/ProjectDescriptionHelpers/InfoPlist.swift b/project/Plugins/ConfigurationPlugin/ProjectDescriptionHelpers/InfoPlist.swift index 6fb1f096..67f38fcb 100644 --- a/project/Plugins/ConfigurationPlugin/ProjectDescriptionHelpers/InfoPlist.swift +++ b/project/Plugins/ConfigurationPlugin/ProjectDescriptionHelpers/InfoPlist.swift @@ -13,7 +13,7 @@ public enum IdleInfoPlist { "CFBundleDisplayName": "$(BUNDLE_DISPLAY_NAME)", - "CFBundleShortVersionString" : "0.0.4", + "CFBundleShortVersionString" : "1.0.1", "NSAppTransportSecurity" : [ "NSAllowsArbitraryLoads" : true @@ -46,9 +46,6 @@ public enum IdleInfoPlist { ], "NMFClientId": "$(NAVER_API_CLIENT_ID)", - - // 앱추적 허용 메세지 - "NSUserTrackingUsageDescription": "사용자 맞춤 서비스 제공을 위해 권한을 허용해 주세요. 권한을 허용하지 않을 경우, 앱 사용에 제약이 있을 수 있습니다.", // 네트워크 사용 메세지 "NSLocalNetworkUsageDescription": "이 앱은 로컬 네트워크를 통해 서버에 연결하여 데이터를 주고받기 위해 로컬 네트워크 접근 권한이 필요합니다." diff --git a/project/Projects/App/Sources/AppDelegate.swift b/project/Projects/App/Sources/AppDelegate.swift index 69eba4b1..9731f31b 100644 --- a/project/Projects/App/Sources/AppDelegate.swift +++ b/project/Projects/App/Sources/AppDelegate.swift @@ -16,9 +16,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate { func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { // Override point for customization after application launch. - DispatchQueue.main.asyncAfter(deadline: .now() + 1.0, execute: { [weak self] in - self?.requestTrackingAuthorization() - }) +// DispatchQueue.main.asyncAfter(deadline: .now() + 1.0, execute: { [weak self] in +// self?.requestTrackingAuthorization() +// }) // FireBase setting FirebaseApp.configure() @@ -40,28 +40,28 @@ class AppDelegate: UIResponder, UIApplicationDelegate { // Use this method to release any resources that were specific to the discarded scenes, as they will not return. } - private func requestTrackingAuthorization() { - ATTrackingManager.requestTrackingAuthorization(completionHandler: { status in - switch status { - case .authorized: - // Tracking authorization dialog was shown - // and we are authorized - printIfDebug("앱추적권한: Authorized") - - // 추적을 허용한 사용자 식별자 - printIfDebug(ASIdentifierManager.shared().advertisingIdentifier) - case .denied: - // Tracking authorization dialog was - // shown and permission is denied - printIfDebug("앱추적권한: Denied") - case .notDetermined: - // Tracking authorization dialog has not been shown - printIfDebug("앱추적권한: Not Determined") - case .restricted: - printIfDebug("앱추적권한: Restricted") - @unknown default: - printIfDebug("앱추적권한: Unknown") - } - }) - } +// private func requestTrackingAuthorization() { +// ATTrackingManager.requestTrackingAuthorization(completionHandler: { status in +// switch status { +// case .authorized: +// // Tracking authorization dialog was shown +// // and we are authorized +// printIfDebug("앱추적권한: Authorized") +// +// // 추적을 허용한 사용자 식별자 +// printIfDebug(ASIdentifierManager.shared().advertisingIdentifier) +// case .denied: +// // Tracking authorization dialog was +// // shown and permission is denied +// printIfDebug("앱추적권한: Denied") +// case .notDetermined: +// // Tracking authorization dialog has not been shown +// printIfDebug("앱추적권한: Not Determined") +// case .restricted: +// printIfDebug("앱추적권한: Restricted") +// @unknown default: +// printIfDebug("앱추적권한: Unknown") +// } +// }) +// } } From f162f04406e3081cc084b1a54f4d28fa61135516 Mon Sep 17 00:00:00 2001 From: J0onYEong Date: Wed, 25 Sep 2024 14:01:04 +0900 Subject: [PATCH 2/5] =?UTF-8?q?[IDLE-000]=20=EC=9A=94=EC=96=91=EB=B3=B4?= =?UTF-8?q?=ED=98=B8=EC=82=AC=20=EB=A1=9C=EA=B9=85=20=EB=82=B4=EC=97=AD=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Coordinator/Worker/WorkerRegisterCoordinator.swift | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/project/Projects/Presentation/Feature/Auth/Sources/Coordinator/Worker/WorkerRegisterCoordinator.swift b/project/Projects/Presentation/Feature/Auth/Sources/Coordinator/Worker/WorkerRegisterCoordinator.swift index ec0ccb09..731974af 100644 --- a/project/Projects/Presentation/Feature/Auth/Sources/Coordinator/Worker/WorkerRegisterCoordinator.swift +++ b/project/Projects/Presentation/Feature/Auth/Sources/Coordinator/Worker/WorkerRegisterCoordinator.swift @@ -12,8 +12,8 @@ import PresentationCore enum WorkerRegisterStage: Int { case registerFinished=0 - case info=1 - case phoneNumber=2 + case phoneNumber=1 + case info=2 case address=3 case finish=4 @@ -21,10 +21,10 @@ enum WorkerRegisterStage: Int { switch self { case .registerFinished: "" - case .info: - "input|personalInfo" case .phoneNumber: "input|phoneNumber" + case .info: + "input|personalInfo" case .address: "input|address" case .finish: @@ -94,7 +94,7 @@ public class WorkerRegisterCoordinator: ChildCoordinator { navigationController.pushViewController(vc, animated: true) - excuteStage(.info, moveTo: .next) + excuteStage(.phoneNumber, moveTo: .next) // MARK: 시작 로깅 logger.startWorkerRegister() From db5a3e02ea6a10cee71fbe081e9800c92ceb15f9 Mon Sep 17 00:00:00 2001 From: J0onYEong Date: Wed, 25 Sep 2024 14:07:05 +0900 Subject: [PATCH 3/5] =?UTF-8?q?[IDLE-000]=20=EA=B3=B5=EA=B3=A0=20=EC=A6=90?= =?UTF-8?q?=EA=B2=A8=EC=B0=BE=EA=B8=B0=20=EC=B7=A8=EC=86=8C=20API=20URI?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- project/Projects/Data/DataSource/API/RcruitmentPostAPI.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/Projects/Data/DataSource/API/RcruitmentPostAPI.swift b/project/Projects/Data/DataSource/API/RcruitmentPostAPI.swift index 48cf8c5e..8450c79e 100644 --- a/project/Projects/Data/DataSource/API/RcruitmentPostAPI.swift +++ b/project/Projects/Data/DataSource/API/RcruitmentPostAPI.swift @@ -84,7 +84,7 @@ extension RcruitmentPostAPI: BaseAPI { case .addFavoritePost(let id, _): "/\(id)/favorites" case .removeFavoritePost(let id): - "/\(id)/favorites" + "/\(id)/remove-favorites" } } From a8f6f8147ab3d2576c993a6858af1e2f4de311b2 Mon Sep 17 00:00:00 2001 From: J0onYEong Date: Wed, 25 Sep 2024 15:40:29 +0900 Subject: [PATCH 4/5] =?UTF-8?q?[IDLE-000]=20=ED=85=8D=EC=8A=A4=ED=8A=B8?= =?UTF-8?q?=ED=95=84=EB=93=9C=20=EB=A0=88=EC=9D=B4=EC=95=84=EC=9B=83=20?= =?UTF-8?q?=EC=98=A4=EB=A5=98=20=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DSKit/Sources/CommonUI/IFType2.swift | 17 +++---- .../TextField/TextFieldWithDegree.swift | 33 +++++++++---- .../TextField/IdleOneLineInputField.swift | 14 +++++- .../Component/TextField/IdleTextField.swift | 48 ++++--------------- 4 files changed, 50 insertions(+), 62 deletions(-) diff --git a/project/Projects/Presentation/DSKit/Sources/CommonUI/IFType2.swift b/project/Projects/Presentation/DSKit/Sources/CommonUI/IFType2.swift index 61689be3..c694e32d 100644 --- a/project/Projects/Presentation/DSKit/Sources/CommonUI/IFType2.swift +++ b/project/Projects/Presentation/DSKit/Sources/CommonUI/IFType2.swift @@ -21,11 +21,11 @@ public class IFType2: UIStackView { public var eventPublisher: Observable { self.idleTextField.eventPublisher } // View - public private(set) lazy var titleLabel: ResizableUILabel = { - let label = ResizableUILabel() - label.text = self.titleLabelText - label.font = DSKitFontFamily.Pretendard.bold.font(size: 14) - label.textColor = DSKitAsset.Colors.gray500.color + public private(set) lazy var titleLabel: IdleLabel = { + let label = IdleLabel(typography: .Subtitle4) + label.textString = self.titleLabelText + label.attrTextColor = DSKitAsset.Colors.gray500.color + label.textAlignment = .left return label }() @@ -66,7 +66,7 @@ public class IFType2: UIStackView { func setStack() { - self.alignment = .leading + self.alignment = .fill self.axis = .vertical self.spacing = 6.0 } @@ -79,11 +79,6 @@ public class IFType2: UIStackView { ].forEach { self.addArrangedSubview($0) } - - NSLayoutConstraint.activate([ - idleTextField.leftAnchor.constraint(equalTo: self.leftAnchor), - idleTextField.rightAnchor.constraint(equalTo: self.rightAnchor), - ]) } public override func resignFirstResponder() -> Bool { diff --git a/project/Projects/Presentation/DSKit/Sources/CommonUI/TextField/TextFieldWithDegree.swift b/project/Projects/Presentation/DSKit/Sources/CommonUI/TextField/TextFieldWithDegree.swift index f712fc79..0b0f1c10 100644 --- a/project/Projects/Presentation/DSKit/Sources/CommonUI/TextField/TextFieldWithDegree.swift +++ b/project/Projects/Presentation/DSKit/Sources/CommonUI/TextField/TextFieldWithDegree.swift @@ -32,7 +32,6 @@ public class TextFieldWithDegree: UIView { }() public lazy var textField: IdleTextField = { let field = IdleTextField(typography: .Body2) - field.textFieldInsets = .zero field.textString = initialText return field }() @@ -63,23 +62,33 @@ public class TextFieldWithDegree: UIView { self.layer.borderColor = DSKitAsset.Colors.gray100.color.cgColor self.layer.borderWidth = 1.0 self.layer.cornerRadius = 6.0 - self.layoutMargins = .init(top: 10, left: 16, bottom: 10, right: 16) } private func setLayout() { + let textFieldWrapper = UIView() + textFieldWrapper.addSubview(textField) + textField.translatesAutoresizingMaskIntoConstraints = false + textFieldWrapper.layoutMargins = .init(top: 10, left: 0, bottom: 10, right: 0) + let stack = HStack( [ - textField, - degreeLabel + textFieldWrapper, + degreeLabel, ], + spacing: 6, distribution: .fill ) - textField.setContentHuggingPriority(.defaultLow, for: .horizontal) + + textFieldWrapper.setContentHuggingPriority(.defaultLow, for: .horizontal) + textFieldWrapper.setContentCompressionResistancePriority(.defaultLow, for: .horizontal) + textField.setContentCompressionResistancePriority(.defaultLow, for: .horizontal) + degreeLabel.setContentHuggingPriority(.defaultHigh, for: .horizontal) degreeLabel.setContentCompressionResistancePriority(.defaultHigh, for: .horizontal) + [ stack ].forEach { @@ -88,10 +97,16 @@ public class TextFieldWithDegree: UIView { } NSLayoutConstraint.activate([ - stack.topAnchor.constraint(equalTo: self.layoutMarginsGuide.topAnchor), - stack.leadingAnchor.constraint(equalTo: self.layoutMarginsGuide.leadingAnchor), - stack.trailingAnchor.constraint(equalTo: self.layoutMarginsGuide.trailingAnchor), - stack.bottomAnchor.constraint(equalTo: self.layoutMarginsGuide.bottomAnchor), + + textField.topAnchor.constraint(equalTo: textFieldWrapper.layoutMarginsGuide.topAnchor), + textField.leftAnchor.constraint(equalTo: textFieldWrapper.layoutMarginsGuide.leftAnchor), + textField.rightAnchor.constraint(equalTo: textFieldWrapper.layoutMarginsGuide.rightAnchor), + textField.bottomAnchor.constraint(equalTo: textFieldWrapper.layoutMarginsGuide.bottomAnchor), + + stack.topAnchor.constraint(equalTo: self.topAnchor), + stack.leadingAnchor.constraint(equalTo: self.leadingAnchor, constant: 16), + stack.trailingAnchor.constraint(equalTo: self.trailingAnchor, constant: -16), + stack.bottomAnchor.constraint(equalTo: self.bottomAnchor), ]) } diff --git a/project/Projects/Presentation/DSKit/Sources/Component/TextField/IdleOneLineInputField.swift b/project/Projects/Presentation/DSKit/Sources/Component/TextField/IdleOneLineInputField.swift index b9fb5fde..6ff8033f 100644 --- a/project/Projects/Presentation/DSKit/Sources/Component/TextField/IdleOneLineInputField.swift +++ b/project/Projects/Presentation/DSKit/Sources/Component/TextField/IdleOneLineInputField.swift @@ -130,8 +130,13 @@ public class IdleOneLineInputField: UIView { self.addSubview($0) } + let textFieldWrapper = UIView() + textFieldWrapper.addSubview(textField) + textField.translatesAutoresizingMaskIntoConstraints = false + textFieldWrapper.layoutMargins = .init(top: 10, left: 16, bottom: 10, right: 24) + [ - textField, + textFieldWrapper, clearButton, completeImage, ].forEach { @@ -147,6 +152,11 @@ public class IdleOneLineInputField: UIView { completeImage.setContentCompressionResistancePriority(.init(751), for: .horizontal) NSLayoutConstraint.activate([ + + textField.topAnchor.constraint(equalTo: textFieldWrapper.layoutMarginsGuide.topAnchor), + textField.leftAnchor.constraint(equalTo: textFieldWrapper.layoutMarginsGuide.leftAnchor), + textField.rightAnchor.constraint(equalTo: textFieldWrapper.layoutMarginsGuide.rightAnchor), + textField.bottomAnchor.constraint(equalTo: textFieldWrapper.layoutMarginsGuide.bottomAnchor), stack.topAnchor.constraint(equalTo: self.layoutMarginsGuide.topAnchor), stack.leadingAnchor.constraint(equalTo: self.layoutMarginsGuide.leadingAnchor), @@ -315,7 +325,7 @@ public extension IdleOneLineInputField { timerLabel.translatesAutoresizingMaskIntoConstraints = false NSLayoutConstraint.activate([ - timerLabel.heightAnchor.constraint(equalTo: textField.heightAnchor), + timerLabel.centerYAnchor.constraint(equalTo: textField.centerYAnchor), ]) self.timerLabel = timerLabel diff --git a/project/Projects/Presentation/DSKit/Sources/Component/TextField/IdleTextField.swift b/project/Projects/Presentation/DSKit/Sources/Component/TextField/IdleTextField.swift index c6c279c2..79b144b2 100644 --- a/project/Projects/Presentation/DSKit/Sources/Component/TextField/IdleTextField.swift +++ b/project/Projects/Presentation/DSKit/Sources/Component/TextField/IdleTextField.swift @@ -14,12 +14,6 @@ public class IdleTextField: UITextField { private var currentTypography: Typography private var currentText: String = "" - private var currentTextFieldInsets: UIEdgeInsets = .init( - top: 10, - left: 16, - bottom: 10, - right: 24 - ) public var textString: String { get { return currentText @@ -47,6 +41,14 @@ public class IdleTextField: UITextField { addToolbar() } + public override var intrinsicContentSize: CGSize { + + return .init( + width: super.intrinsicContentSize.width, + height: typography.lineHeight ?? super.intrinsicContentSize.height + ) + } + public required init?(coder: NSCoder) { fatalError() } public func addToolbar() { @@ -89,17 +91,6 @@ public class IdleTextField: UITextField { } } - public var textFieldInsets: UIEdgeInsets { - - get { - currentTextFieldInsets - } - set { - currentTextFieldInsets = newValue - self.setNeedsLayout() - } - } - public var attrPlaceholder: String { get { @@ -116,26 +107,3 @@ public class IdleTextField: UITextField { self.rx.attributedText.onNext(NSAttributedString(string: textString, attributes: currentTypography.attributes)) } } - - -public extension IdleTextField { - - // 텍스트 영역의 프레임을 반환 - override func textRect(forBounds bounds: CGRect) -> CGRect { - setInset(bounds: bounds) - } - - // 편집 중일 때 텍스트 영역의 프레임을 반환 - override func editingRect(forBounds bounds: CGRect) -> CGRect { - setInset(bounds: bounds) - } - - // 플레이스홀더 텍스트 영역의 프레임을 반환 - override func placeholderRect(forBounds bounds: CGRect) -> CGRect { - setInset(bounds: bounds) - } - - private func setInset(bounds: CGRect) -> CGRect { - bounds.inset(by: currentTextFieldInsets) - } -} From e67eb7af45145c636dbf82ef62f0492fbb6a292f Mon Sep 17 00:00:00 2001 From: J0onYEong Date: Wed, 25 Sep 2024 16:20:53 +0900 Subject: [PATCH 5/5] =?UTF-8?q?[IDLE-000]=20=ED=85=8D=EC=8A=A4=ED=8A=B8?= =?UTF-8?q?=ED=95=84=EB=93=9C=20=EB=A0=88=EC=9D=B4=EC=95=84=EC=9B=83=20?= =?UTF-8?q?=EC=98=A4=EB=A5=98=20=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit AttrString의 경우 lineHeight옵션 지정시 입력시 레이아웃이 깨짐 따라서 텍스트필드에 대해선 라인 Height을 적용하지 않도록 구현 --- .../TextField/TextFieldWithDegree.swift | 10 +++---- .../TextField/IdleOneLineInputField.swift | 10 +++---- .../Component/TextField/IdleTextField.swift | 26 +++++++++---------- .../Component/Typography/Typograpy.swift | 8 ++++++ 4 files changed, 29 insertions(+), 25 deletions(-) diff --git a/project/Projects/Presentation/DSKit/Sources/CommonUI/TextField/TextFieldWithDegree.swift b/project/Projects/Presentation/DSKit/Sources/CommonUI/TextField/TextFieldWithDegree.swift index 0b0f1c10..18837a9b 100644 --- a/project/Projects/Presentation/DSKit/Sources/CommonUI/TextField/TextFieldWithDegree.swift +++ b/project/Projects/Presentation/DSKit/Sources/CommonUI/TextField/TextFieldWithDegree.swift @@ -69,7 +69,6 @@ public class TextFieldWithDegree: UIView { let textFieldWrapper = UIView() textFieldWrapper.addSubview(textField) textField.translatesAutoresizingMaskIntoConstraints = false - textFieldWrapper.layoutMargins = .init(top: 10, left: 0, bottom: 10, right: 0) let stack = HStack( [ @@ -77,6 +76,7 @@ public class TextFieldWithDegree: UIView { degreeLabel, ], spacing: 6, + alignment: .center, distribution: .fill ) @@ -98,10 +98,10 @@ public class TextFieldWithDegree: UIView { NSLayoutConstraint.activate([ - textField.topAnchor.constraint(equalTo: textFieldWrapper.layoutMarginsGuide.topAnchor), - textField.leftAnchor.constraint(equalTo: textFieldWrapper.layoutMarginsGuide.leftAnchor), - textField.rightAnchor.constraint(equalTo: textFieldWrapper.layoutMarginsGuide.rightAnchor), - textField.bottomAnchor.constraint(equalTo: textFieldWrapper.layoutMarginsGuide.bottomAnchor), + textFieldWrapper.heightAnchor.constraint(equalToConstant: 44), + textField.centerYAnchor.constraint(equalTo: textFieldWrapper.centerYAnchor), + textField.leftAnchor.constraint(equalTo: textFieldWrapper.leftAnchor), + textField.rightAnchor.constraint(equalTo: textFieldWrapper.rightAnchor), stack.topAnchor.constraint(equalTo: self.topAnchor), stack.leadingAnchor.constraint(equalTo: self.leadingAnchor, constant: 16), diff --git a/project/Projects/Presentation/DSKit/Sources/Component/TextField/IdleOneLineInputField.swift b/project/Projects/Presentation/DSKit/Sources/Component/TextField/IdleOneLineInputField.swift index 6ff8033f..7a07d4be 100644 --- a/project/Projects/Presentation/DSKit/Sources/Component/TextField/IdleOneLineInputField.swift +++ b/project/Projects/Presentation/DSKit/Sources/Component/TextField/IdleOneLineInputField.swift @@ -133,7 +133,6 @@ public class IdleOneLineInputField: UIView { let textFieldWrapper = UIView() textFieldWrapper.addSubview(textField) textField.translatesAutoresizingMaskIntoConstraints = false - textFieldWrapper.layoutMargins = .init(top: 10, left: 16, bottom: 10, right: 24) [ textFieldWrapper, @@ -152,11 +151,10 @@ public class IdleOneLineInputField: UIView { completeImage.setContentCompressionResistancePriority(.init(751), for: .horizontal) NSLayoutConstraint.activate([ - - textField.topAnchor.constraint(equalTo: textFieldWrapper.layoutMarginsGuide.topAnchor), - textField.leftAnchor.constraint(equalTo: textFieldWrapper.layoutMarginsGuide.leftAnchor), - textField.rightAnchor.constraint(equalTo: textFieldWrapper.layoutMarginsGuide.rightAnchor), - textField.bottomAnchor.constraint(equalTo: textFieldWrapper.layoutMarginsGuide.bottomAnchor), + textFieldWrapper.heightAnchor.constraint(equalToConstant: 44), + textField.centerYAnchor.constraint(equalTo: textFieldWrapper.centerYAnchor), + textField.leftAnchor.constraint(equalTo: textFieldWrapper.leftAnchor, constant: 16), + textField.rightAnchor.constraint(equalTo: textFieldWrapper.rightAnchor, constant: -24), stack.topAnchor.constraint(equalTo: self.layoutMarginsGuide.topAnchor), stack.leadingAnchor.constraint(equalTo: self.layoutMarginsGuide.leadingAnchor), diff --git a/project/Projects/Presentation/DSKit/Sources/Component/TextField/IdleTextField.swift b/project/Projects/Presentation/DSKit/Sources/Component/TextField/IdleTextField.swift index 79b144b2..c26b9915 100644 --- a/project/Projects/Presentation/DSKit/Sources/Component/TextField/IdleTextField.swift +++ b/project/Projects/Presentation/DSKit/Sources/Component/TextField/IdleTextField.swift @@ -12,7 +12,7 @@ import PresentationCore /// 기본이 되는 텍스트 필드입니다. public class IdleTextField: UITextField { - private var currentTypography: Typography + private var currentTypography: Typography! private var currentText: String = "" public var textString: String { get { @@ -26,11 +26,9 @@ public class IdleTextField: UITextField { public init(typography: Typography) { - self.currentTypography = typography - super.init(frame: .zero) - self.defaultTextAttributes = typography.attributes + self.typography = typography self.autocorrectionType = .no // 첫 글자 자동 대문자화 끄기 @@ -41,13 +39,13 @@ public class IdleTextField: UITextField { addToolbar() } - public override var intrinsicContentSize: CGSize { - - return .init( - width: super.intrinsicContentSize.width, - height: typography.lineHeight ?? super.intrinsicContentSize.height - ) - } +// public override var intrinsicContentSize: CGSize { +// +// return .init( +// width: super.intrinsicContentSize.width, +// height: typography.lineHeight ?? super.intrinsicContentSize.height +// ) +// } public required init?(coder: NSCoder) { fatalError() } @@ -86,7 +84,7 @@ public class IdleTextField: UITextField { } set { currentTypography = newValue - defaultTextAttributes = currentTypography.attributes + defaultTextAttributes = currentTypography.attributesWithoutLineHeightInset self.updateText() } } @@ -97,13 +95,13 @@ public class IdleTextField: UITextField { attributedPlaceholder?.string ?? "" } set { - attributedPlaceholder = currentTypography.attributes.toString( + attributedPlaceholder = currentTypography.attributesWithoutLineHeightInset.toString( newValue, with: DSKitAsset.Colors.gray200.color ) } } private func updateText() { - self.rx.attributedText.onNext(NSAttributedString(string: textString, attributes: currentTypography.attributes)) + self.rx.attributedText.onNext(NSAttributedString(string: textString, attributes: currentTypography.attributesWithoutLineHeightInset)) } } diff --git a/project/Projects/Presentation/DSKit/Sources/Component/Typography/Typograpy.swift b/project/Projects/Presentation/DSKit/Sources/Component/Typography/Typograpy.swift index 851413d5..335889e5 100644 --- a/project/Projects/Presentation/DSKit/Sources/Component/Typography/Typograpy.swift +++ b/project/Projects/Presentation/DSKit/Sources/Component/Typography/Typograpy.swift @@ -68,6 +68,14 @@ public enum Typography { } } + public var attributesWithoutLineHeightInset: Attrubutes { + var attrs = attributes + (attrs[.paragraphStyle] as? NSMutableParagraphStyle)?.minimumLineHeight = 0 + (attrs[.paragraphStyle] as? NSMutableParagraphStyle)?.maximumLineHeight = 0 + attrs[.baselineOffset] = 0 + return attrs + } + public var attributes: Attrubutes { switch self {