diff --git a/project/Plugins/ConfigurationPlugin/ProjectDescriptionHelpers/InfoPlist.swift b/project/Plugins/ConfigurationPlugin/ProjectDescriptionHelpers/InfoPlist.swift index 36a607b6..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 diff --git a/project/Projects/App/Sources/AppDelegate.swift b/project/Projects/App/Sources/AppDelegate.swift index 10f8f43a..11652c77 100644 --- a/project/Projects/App/Sources/AppDelegate.swift +++ b/project/Projects/App/Sources/AppDelegate.swift @@ -43,5 +43,4 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions. // Use this method to release any resources that were specific to the discarded scenes, as they will not return. } - } 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" } } 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..18837a9b 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 + let stack = HStack( [ - textField, - degreeLabel + textFieldWrapper, + degreeLabel, ], + spacing: 6, + alignment: .center, 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), + + 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), + 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..7a07d4be 100644 --- a/project/Projects/Presentation/DSKit/Sources/Component/TextField/IdleOneLineInputField.swift +++ b/project/Projects/Presentation/DSKit/Sources/Component/TextField/IdleOneLineInputField.swift @@ -130,8 +130,12 @@ public class IdleOneLineInputField: UIView { self.addSubview($0) } + let textFieldWrapper = UIView() + textFieldWrapper.addSubview(textField) + textField.translatesAutoresizingMaskIntoConstraints = false + [ - textField, + textFieldWrapper, clearButton, completeImage, ].forEach { @@ -147,6 +151,10 @@ public class IdleOneLineInputField: UIView { completeImage.setContentCompressionResistancePriority(.init(751), for: .horizontal) NSLayoutConstraint.activate([ + 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), @@ -315,7 +323,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..c26b9915 100644 --- a/project/Projects/Presentation/DSKit/Sources/Component/TextField/IdleTextField.swift +++ b/project/Projects/Presentation/DSKit/Sources/Component/TextField/IdleTextField.swift @@ -12,14 +12,8 @@ import PresentationCore /// 기본이 되는 텍스트 필드입니다. public class IdleTextField: UITextField { - private var currentTypography: Typography + 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 @@ -32,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 // 첫 글자 자동 대문자화 끄기 @@ -47,6 +39,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() { @@ -84,58 +84,24 @@ public class IdleTextField: UITextField { } set { currentTypography = newValue - defaultTextAttributes = currentTypography.attributes + defaultTextAttributes = currentTypography.attributesWithoutLineHeightInset self.updateText() } } - public var textFieldInsets: UIEdgeInsets { - - get { - currentTextFieldInsets - } - set { - currentTextFieldInsets = newValue - self.setNeedsLayout() - } - } - public var attrPlaceholder: String { get { 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)) - } -} - - -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) + 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 {