diff --git a/Poppool/CoreLayer/Infrastructure/Infrastructure/Extension/String+.swift b/Poppool/CoreLayer/Infrastructure/Infrastructure/Extension/String+.swift new file mode 100644 index 00000000..fb7c74e2 --- /dev/null +++ b/Poppool/CoreLayer/Infrastructure/Infrastructure/Extension/String+.swift @@ -0,0 +1,7 @@ +import Foundation + +public extension String { + var isHangul: Bool { + return "\(self)".range(of: "\\p{Hangul}", options: .regularExpression) != nil + } +} diff --git a/Poppool/PresentationLayer/DesignSystem/DesignSystem/Components/PPButton.swift b/Poppool/PresentationLayer/DesignSystem/DesignSystem/Components/PPButton.swift index c4e2a4cd..67151e7a 100644 --- a/Poppool/PresentationLayer/DesignSystem/DesignSystem/Components/PPButton.swift +++ b/Poppool/PresentationLayer/DesignSystem/DesignSystem/Components/PPButton.swift @@ -1,5 +1,7 @@ import UIKit +import Infrastructure + public class PPButton: UIButton { public enum ButtonStyle { @@ -62,6 +64,29 @@ public class PPButton: UIButton { } } + public init( + buttonStyle: ButtonStyle, + fontStyle: PPFontStyle = .KOm16, + text: String, + disabledText: String = " ", + cornerRadius: CGFloat = 4 + ) { + super.init(frame: .zero) + + self.setTitleColor(buttonStyle.textColor, for: .normal) + self.setTitleColor(buttonStyle.disabledTextColor, for: .disabled) + + self.setBackgroundColor(buttonStyle.backgroundColor, for: .normal) + self.setBackgroundColor(buttonStyle.disabledBackgroundColor, for: .disabled) + + self.setText(to: text, with: fontStyle, for: .normal) + self.setText(to: disabledText, with: fontStyle, for: .disabled) + + self.layer.cornerRadius = cornerRadius + self.clipsToBounds = true + } + + @available(*, deprecated, message: "PPFontStyle로 파싱하는 init을 사용해주세요.") public init( style: ButtonStyle, text: String, @@ -71,8 +96,12 @@ public class PPButton: UIButton { ) { super.init(frame: .zero) - self.setTitle(text, for: .normal) - self.setTitle(disabledText, for: .disabled) + guard let parseResult = parseToPPFontStyle(text: text, font: font), + let PPFontStyle = PPFontStyle(rawValue: parseResult) + else { + Logger.log("PPFontStyle로 파싱할 수 없는 폰트입니다.", category: .error) + return + } self.setTitleColor(style.textColor, for: .normal) self.setTitleColor(style.disabledTextColor, for: .disabled) @@ -80,7 +109,9 @@ public class PPButton: UIButton { self.setBackgroundColor(style.backgroundColor, for: .normal) self.setBackgroundColor(style.disabledBackgroundColor, for: .disabled) - self.titleLabel?.font = font + self.setText(to: text, with: PPFontStyle, for: .normal) + self.setText(to: disabledText, with: PPFontStyle, for: .disabled) + self.layer.cornerRadius = cornerRadius self.clipsToBounds = true } @@ -105,3 +136,26 @@ public class PPButton: UIButton { self.setBackgroundImage(backgroundImage, for: state) } } + +private extension PPButton { + func parseToPPFontStyle(text: String?, font: UIFont?) -> String? { + guard let font = font else { return nil } + + var result = "" + + let splitResult = font.fontName.split(separator: "-") + splitResult[0] == "Poppins" ? result.append("EN") : result.append("KO") + + switch splitResult[1] { + case "Light": result.append("l") + case "Regular": result.append("r") + case "Medium": result.append("m") + case "Bold": result.append("b") + default: return nil + } + + result.append("\(Int(font.pointSize))") + + return result + } +} diff --git a/Poppool/PresentationLayer/DesignSystem/DesignSystem/Components/PPCancelHeaderView.swift b/Poppool/PresentationLayer/DesignSystem/DesignSystem/Components/PPCancelHeaderView.swift index 777f79cf..155912c3 100644 --- a/Poppool/PresentationLayer/DesignSystem/DesignSystem/Components/PPCancelHeaderView.swift +++ b/Poppool/PresentationLayer/DesignSystem/DesignSystem/Components/PPCancelHeaderView.swift @@ -14,9 +14,8 @@ public final class PPCancelHeaderView: UIView { public let cancelButton: UIButton = { let button = UIButton(type: .system) - button.setTitle("취소", for: .normal) - button.titleLabel?.font = .korFont(style: .regular, size: 14) button.setTitleColor(.black, for: .normal) + button.setText(to: "취소", with: .KOr14, for: .normal) return button }() diff --git a/Poppool/PresentationLayer/DesignSystem/DesignSystem/Components/PPLabel.swift b/Poppool/PresentationLayer/DesignSystem/DesignSystem/Components/PPLabel.swift index d27c4daf..1cd495d1 100644 --- a/Poppool/PresentationLayer/DesignSystem/DesignSystem/Components/PPLabel.swift +++ b/Poppool/PresentationLayer/DesignSystem/DesignSystem/Components/PPLabel.swift @@ -2,23 +2,61 @@ import UIKit public class PPLabel: UILabel { + @available(*, deprecated, renamed: "init(text:style:)", message: "타이포를 직접 지정하는 대신 PPFontStyle을 이용하세요") public init( style: UIFont.FontStyle = .regular, fontSize: CGFloat = 12, - text: String = "", + text: String = " ", lineHeight: CGFloat = 1.2 ) { super.init(frame: .zero) - self.font = .korFont(style: style, size: fontSize) - let paragraphStyle = NSMutableParagraphStyle() - paragraphStyle.lineHeightMultiple = lineHeight - self.attributedText = NSMutableAttributedString( - string: text, - attributes: [NSAttributedString.Key.paragraphStyle: paragraphStyle] - ) +// self.font = .korFont(style: style, size: fontSize) +// let paragraphStyle = NSMutableParagraphStyle() +// paragraphStyle.lineHeightMultiple = lineHeight +// self.attributedText = NSMutableAttributedString( +// string: text, +// attributes: [NSAttributedString.Key.paragraphStyle: paragraphStyle] +// ) + + guard let parseResult = parseToPPFontStyle( + style: style, + fontSize: fontSize, + text: text + ) else { return } + + self.setText(to: text, with: PPFontStyle(rawValue: parseResult) ?? .KOb32) + } + + public init( + text: String = " ", // 값이 없으면 Attribute가 적용이 안돼서 기본값은 공백 + style: PPFontStyle + ) { + super.init(frame: .zero) + self.setText(to: text, with: style) } required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } } + +private extension PPLabel { + func parseToPPFontStyle( + style: UIFont.FontStyle, + fontSize: CGFloat, + text: String + ) -> String? { + var result = text.isHangul ? "KO" : "EN" + + switch style { + case .bold: result.append("b") + case .medium: result.append("m") + case .regular: result.append("r") + case .light: result.append("l") + } + + result.append("\(Int(fontSize))") + + return result + } +} diff --git a/Poppool/PresentationLayer/DesignSystem/DesignSystem/Components/PPSearchBarView.swift b/Poppool/PresentationLayer/DesignSystem/DesignSystem/Components/PPSearchBarView.swift index 0306def6..f971da5e 100644 --- a/Poppool/PresentationLayer/DesignSystem/DesignSystem/Components/PPSearchBarView.swift +++ b/Poppool/PresentationLayer/DesignSystem/DesignSystem/Components/PPSearchBarView.swift @@ -12,7 +12,11 @@ public class PPSearchBarView: UIView { } public let searchBar = UISearchBar().then { - $0.searchTextField.setPlaceholder(text: "팝업스토어명을 입력해보세요", color: .g400, font: .korFont(style: .regular, size: 14)) + $0.searchTextField.setPlaceholder( + text: "팝업스토어명을 입력해보세요", + color: .g400, + style: .KOr14 + ) $0.tintColor = .g400 $0.backgroundColor = .g50 $0.layer.cornerRadius = 4 diff --git a/Poppool/PresentationLayer/DesignSystem/DesignSystem/Components/PPTagCollectionViewCell/PPTagCollectionViewCell.swift b/Poppool/PresentationLayer/DesignSystem/DesignSystem/Components/PPTagCollectionViewCell/PPTagCollectionViewCell.swift index 304d3456..dff383ca 100644 --- a/Poppool/PresentationLayer/DesignSystem/DesignSystem/Components/PPTagCollectionViewCell/PPTagCollectionViewCell.swift +++ b/Poppool/PresentationLayer/DesignSystem/DesignSystem/Components/PPTagCollectionViewCell/PPTagCollectionViewCell.swift @@ -9,7 +9,7 @@ public final class PPTagCollectionViewCell: UICollectionViewCell { public var disposeBag = DisposeBag() - public let titleLabel = PPLabel(style: .medium, fontSize: 11) + public let titleLabel = PPLabel(style: .KOm11) public let cancelButton = UIButton() @@ -83,6 +83,7 @@ private extension PPTagCollectionViewCell { } } +// FIXME: Chip 컴포넌트화 및 분기적용 필요 (디자인 시스템 도입 필요) extension PPTagCollectionViewCell { public func configureCell(title: String? = nil, id: Int?, isSelected: Bool = false, isCancelable: Bool = true, fontSize: CGFloat = 11, cornerRadius: CGFloat = 15.5) { let xmarkImage = isSelected ? UIImage(named: "icon_xmark_white") : UIImage(named: "icon_xmark_gray") diff --git a/Poppool/PresentationLayer/DesignSystem/DesignSystem/Components/PopupGridCollectionViewCell/PPPopupGridCollectionViewCell.swift b/Poppool/PresentationLayer/DesignSystem/DesignSystem/Components/PopupGridCollectionViewCell/PPPopupGridCollectionViewCell.swift index 0e8d1944..d74937ad 100644 --- a/Poppool/PresentationLayer/DesignSystem/DesignSystem/Components/PopupGridCollectionViewCell/PPPopupGridCollectionViewCell.swift +++ b/Poppool/PresentationLayer/DesignSystem/DesignSystem/Components/PopupGridCollectionViewCell/PPPopupGridCollectionViewCell.swift @@ -15,40 +15,35 @@ public final class PPPopupGridCollectionViewCell: UICollectionViewCell { $0.contentMode = .scaleAspectFill } - private let categoryLabel = PPLabel(style: .bold, fontSize: 11).then { + private let categoryLabel = PPLabel(style: .KOb11).then { $0.textColor = .blu500 - $0.setLineHeightText(text: "category", font: .korFont(style: .bold, size: 11)) } - private let titleLabel = PPLabel(style: .bold, fontSize: 14).then { + private let titleLabel = PPLabel(style: .KOb14).then { $0.numberOfLines = 2 $0.lineBreakMode = .byTruncatingTail - $0.setLineHeightText(text: "title", font: .korFont(style: .bold, size: 14)) } - private let addressLabel = PPLabel(style: .medium, fontSize: 11).then { + private let addressLabel = PPLabel(style: .KOm11).then { $0.numberOfLines = 1 $0.lineBreakMode = .byTruncatingTail $0.textColor = .g400 - $0.setLineHeightText(text: "address", font: .korFont(style: .medium, size: 11)) } - private let dateLabel = PPLabel(style: .medium, fontSize: 11).then { + private let dateLabel = PPLabel(style: .ENr11).then { $0.lineBreakMode = .byTruncatingTail $0.textColor = .g400 - $0.setLineHeightText(text: "date", font: .korFont(style: .medium, size: 11)) } public let bookmarkButton = UIButton() - private let rankLabel = UILabel().then { + private let rankLabel = PPLabel(style: .KOm11).then { $0.backgroundColor = .w10 $0.layer.cornerRadius = 12 $0.clipsToBounds = true $0.isHidden = true $0.textColor = .w100 $0.textAlignment = .center - $0.setLineHeightText(text: "rank", font: .korFont(style: .medium, size: 11), lineHeight: 1) } // MARK: - init @@ -103,14 +98,12 @@ private extension PPPopupGridCollectionViewCell { dateLabel.snp.makeConstraints { make in make.leading.equalToSuperview() - make.height.equalTo(15).priority(.high) make.bottom.equalToSuperview() } addressLabel.snp.makeConstraints { make in make.leading.trailing.equalToSuperview() make.bottom.equalTo(dateLabel.snp.top) - make.height.equalTo(17).priority(.high) } bookmarkButton.snp.makeConstraints { make in @@ -137,12 +130,12 @@ private extension PPPopupGridCollectionViewCell { extension PPPopupGridCollectionViewCell { public func configureCell(imagePath: String?, id: Int64, category: String?, title: String?, address: String?, startDate: String?, endDate: String?, isBookmark: Bool, isLogin: Bool, isPopular: Bool = false, row: Int?) { - categoryLabel.text = "#" + (category ?? "") - titleLabel.text = title - addressLabel.text = address + categoryLabel.updateText(to: "#" + (category ?? "")) + titleLabel.updateText(to: title) + addressLabel.updateText(to: address) let date = startDate.toDate().toPPDateString() + " ~ " + endDate.toDate().toPPDateString() - dateLabel.text = date + dateLabel.updateText(to: date) let bookmarkImage = isBookmark ? UIImage(named: "icon_bookmark_fill") : UIImage(named: "icon_bookmark") bookmarkButton.setImage(bookmarkImage, for: .normal) @@ -153,7 +146,7 @@ extension PPPopupGridCollectionViewCell { rankLabel.isHidden = !isPopular if let rank = row { - rankLabel.text = "\(rank)" + rankLabel.updateText(to: "\(rank)") rankLabel.isHidden = rank > 2 } } diff --git a/Poppool/PresentationLayer/DesignSystem/DesignSystem/Extension/UIButton+.swift b/Poppool/PresentationLayer/DesignSystem/DesignSystem/Extension/UIButton+.swift new file mode 100644 index 00000000..d97038a7 --- /dev/null +++ b/Poppool/PresentationLayer/DesignSystem/DesignSystem/Extension/UIButton+.swift @@ -0,0 +1,26 @@ +import UIKit + +public extension UIButton { + /// Style을 필요로하는 Text가 포함된 일반 버튼에서 사용 + func setText( + to text: String = " ", + with style: PPFontStyle, + for controlState: UIControl.State = .normal + ) { + let paragraphStyle = NSMutableParagraphStyle() + paragraphStyle.lineHeightMultiple = style.lineHeightMultiple + paragraphStyle.maximumLineHeight = style.lineHeight + paragraphStyle.minimumLineHeight = style.lineHeight + + let attributedString = NSAttributedString( + string: text, + attributes: [ + .font: UIFont.PPFont(style: style), + .paragraphStyle: paragraphStyle, + .baselineOffset: style.baseLineOffset + ] + ) + + self.setAttributedTitle(attributedString, for: controlState) + } +} diff --git a/Poppool/PresentationLayer/DesignSystem/DesignSystem/Extension/UIFont+.swift b/Poppool/PresentationLayer/DesignSystem/DesignSystem/Extension/UIFont+.swift index 9723e545..dc303a58 100644 --- a/Poppool/PresentationLayer/DesignSystem/DesignSystem/Extension/UIFont+.swift +++ b/Poppool/PresentationLayer/DesignSystem/DesignSystem/Extension/UIFont+.swift @@ -21,6 +21,14 @@ public extension UIFont { if let font = UIFont(name: fontName, size: size) { return font } else { return registerAndGetFont(name: fontName, size: size) } } + static func PPFont(style: PPFontStyle) -> UIFont { + if let font = UIFont(name: style.fontName, size: style.size) { + return font + } else { + return registerAndGetFont(name: style.fontName, size: style.size) + } + } + private static func registerAndGetFont(name: String, size: CGFloat) -> UIFont { let url = Bundle.module.url(forResource: name, withExtension: "ttf")! CTFontManagerRegisterFontURLs([url as CFURL] as CFArray, .process, true, nil) diff --git a/Poppool/PresentationLayer/DesignSystem/DesignSystem/Extension/UILabel+.swift b/Poppool/PresentationLayer/DesignSystem/DesignSystem/Extension/UILabel+.swift index eb0caec1..e30c16b7 100644 --- a/Poppool/PresentationLayer/DesignSystem/DesignSystem/Extension/UILabel+.swift +++ b/Poppool/PresentationLayer/DesignSystem/DesignSystem/Extension/UILabel+.swift @@ -1,17 +1,74 @@ import UIKit public extension UILabel { + @available(*, deprecated, message: "직접 속성을 넣는 방법 대신 타이포시스템을 이용하는 `updateText(to:)`또는 `setText(to:with:)`을 이용해주세요") func setLineHeightText(text: String?, font: UIFont?, lineHeight: CGFloat = 1.3) { guard let text = text, let font = font else { return } + + guard let parseResult = parseToPPFontStyle(text: text, font: font) else { return } + + self.setText(to: text, with: PPFontStyle(rawValue: parseResult) ?? .KOb32) +// +// let paragraphStyle = NSMutableParagraphStyle() +// paragraphStyle.lineBreakMode = .byTruncatingTail +// paragraphStyle.lineHeightMultiple = lineHeight +// self.attributedText = NSMutableAttributedString( +// string: text, +// attributes: [ +// .paragraphStyle: paragraphStyle, +// .font: font +// ] +// ) + } + + /// 기존 attributedText 속성을 유지하며 텍스트만 교체합니다. + func updateText(to text: String?) { + guard let current = self.attributedText, current.length > 0 else { + self.text = text + return + } + let attributes = current.attributes(at: 0, effectiveRange: nil) + self.attributedText = NSAttributedString(string: text ?? " ", attributes: attributes) + } + + /// Style이 포함된 텍스트를 적용합니다. + func setText(to text: String?, with style: PPFontStyle) { let paragraphStyle = NSMutableParagraphStyle() paragraphStyle.lineBreakMode = .byTruncatingTail - paragraphStyle.lineHeightMultiple = lineHeight + paragraphStyle.lineHeightMultiple = style.lineHeightMultiple + paragraphStyle.maximumLineHeight = style.lineHeight + paragraphStyle.minimumLineHeight = style.lineHeight + self.attributedText = NSMutableAttributedString( - string: text, + string: text ?? " ", attributes: [ + .font: UIFont.PPFont(style: style), .paragraphStyle: paragraphStyle, - .font: font + .baselineOffset: style.baseLineOffset ] ) } } + +private extension UILabel { + func parseToPPFontStyle(text: String?, font: UIFont?) -> String? { + guard let font = font else { return nil } + + var result = "" + + let splitResult = font.fontName.split(separator: "-") + splitResult[0] == "Poppins" ? result.append("EN") : result.append("KO") + + switch splitResult[1] { + case "Light": result.append("l") + case "Regular": result.append("r") + case "Medium": result.append("m") + case "Bold": result.append("b") + default: return nil + } + + result.append("\(Int(font.pointSize))") + + return result + } +} diff --git a/Poppool/PresentationLayer/DesignSystem/DesignSystem/Extension/UITextField+.swift b/Poppool/PresentationLayer/DesignSystem/DesignSystem/Extension/UITextField+.swift index 883720b9..4ae0cab5 100644 --- a/Poppool/PresentationLayer/DesignSystem/DesignSystem/Extension/UITextField+.swift +++ b/Poppool/PresentationLayer/DesignSystem/DesignSystem/Extension/UITextField+.swift @@ -1,10 +1,30 @@ import UIKit public extension UITextField { + @available(*, deprecated, message: "직접 속성을 넣는 방법 대신 타이포시스템을 이용하는 `setPlaceholder(text:color:style:)`을 이용해주세요") func setPlaceholder(text: String, color: UIColor, font: UIFont) { self.attributedPlaceholder = NSAttributedString( string: text, attributes: [.foregroundColor: color, .font: font] ) } + + func setPlaceholder(text: String, color: UIColor, style: PPFontStyle) { + let paragraphStyle = NSMutableParagraphStyle() + let font = UIFont.PPFont(style: style) + + paragraphStyle.lineHeightMultiple = style.lineHeightMultiple + paragraphStyle.maximumLineHeight = style.lineHeight + paragraphStyle.minimumLineHeight = style.lineHeight + + self.attributedPlaceholder = NSAttributedString( + string: text, + attributes: [ + .foregroundColor: color, + .paragraphStyle: paragraphStyle, + .baselineOffset: style.baseLineOffset, + .font: font + ] + ) + } } diff --git a/Poppool/PresentationLayer/DesignSystem/DesignSystem/Font/PPFontStyle.swift b/Poppool/PresentationLayer/DesignSystem/DesignSystem/Font/PPFontStyle.swift new file mode 100644 index 00000000..ab62e0b2 --- /dev/null +++ b/Poppool/PresentationLayer/DesignSystem/DesignSystem/Font/PPFontStyle.swift @@ -0,0 +1,94 @@ +import Foundation +import UIKit + +// MARK: - Font cases +public enum PPFontStyle: String { + // 한국어 Typeface Guide + case KOl32, KOl28, KOl24, KOl20, KOl18, KOl16, KOl15, KOl14, KOl13, KOl12, KOl11 + case KOr32, KOr28, KOr24, KOr20, KOr18, KOr16, KOr15, KOr14, KOr13, KOr12, KOr11 + case KOm32, KOm28, KOm24, KOm20, KOm18, KOm16, KOm15, KOm14, KOm13, KOm12, KOm11 + case KOb32, KOb28, KOb24, KOb20, KOb18, KOb16, KOb15, KOb14, KOb13, KOb12, KOb11 + + // 영어 Typeface Guide + case ENl32, ENl28, ENl24, ENl20, ENl18, ENl16, ENl15, ENl14, ENl13, ENl12, ENl11 + case ENr32, ENr28, ENr24, ENr20, ENr18, ENr16, ENr15, ENr14, ENr13, ENr12, ENr11 + case ENm32, ENm28, ENm24, ENm20, ENm18, ENm16, ENm15, ENm14, ENm13, ENm12, ENm11 + case ENb32, ENb28, ENb24, ENb20, ENb18, ENb16, ENb15, ENb14, ENb13, ENb12, ENb11 +} + +// MARK: - Font size +extension PPFontStyle { + /// 폰트 패밀리 크기 + public var size: CGFloat { + switch self { + case .KOl32, .KOr32, .KOm32, .KOb32, .ENl32, .ENr32, .ENm32, .ENb32: return 32 + case .KOl28, .KOr28, .KOm28, .KOb28, .ENl28, .ENr28, .ENm28, .ENb28: return 28 + case .KOl24, .KOr24, .KOm24, .KOb24, .ENl24, .ENr24, .ENm24, .ENb24: return 24 + case .KOl20, .KOr20, .KOm20, .KOb20, .ENl20, .ENr20, .ENm20, .ENb20: return 20 + case .KOl18, .KOr18, .KOm18, .KOb18, .ENl18, .ENr18, .ENm18, .ENb18: return 18 + case .KOl16, .KOr16, .KOm16, .KOb16, .ENl16, .ENr16, .ENm16, .ENb16: return 16 + case .KOl15, .KOr15, .KOm15, .KOb15, .ENl15, .ENr15, .ENm15, .ENb15: return 15 + case .KOl14, .KOr14, .KOm14, .KOb14, .ENl14, .ENr14, .ENm14, .ENb14: return 14 + case .KOl13, .KOr13, .KOm13, .KOb13, .ENl13, .ENr13, .ENm13, .ENb13: return 13 + case .KOl12, .KOr12, .KOm12, .KOb12, .ENl12, .ENr12, .ENm12, .ENb12: return 12 + case .KOl11, .KOr11, .KOm11, .KOb11, .ENl11, .ENr11, .ENm11, .ENb11: return 11 + } + } +} + +// MARK: - Font name +extension PPFontStyle { + /// 폰트 패밀리 이름 + public var fontName: String { + switch self { + case .KOl32, .KOl28, .KOl24, .KOl20, .KOl18, .KOl16, .KOl15, .KOl14, .KOl13, .KOl12, .KOl11: return "GothicA1-Light" + case .KOr32, .KOr28, .KOr24, .KOr20, .KOr18, .KOr16, .KOr15, .KOr14, .KOr13, .KOr12, .KOr11: return "GothicA1-Regular" + case .KOm32, .KOm28, .KOm24, .KOm20, .KOm18, .KOm16, .KOm15, .KOm14, .KOm13, .KOm12, .KOm11: return "GothicA1-Medium" + case .KOb32, .KOb28, .KOb24, .KOb20, .KOb18, .KOb16, .KOb15, .KOb14, .KOb13, .KOb12, .KOb11: return "GothicA1-Bold" + + case .ENl32, .ENl28, .ENl24, .ENl20, .ENl18, .ENl16, .ENl15, .ENl14, .ENl13, .ENl12, .ENl11: return "Poppins-Light" + case .ENr32, .ENr28, .ENr24, .ENr20, .ENr18, .ENr16, .ENr15, .ENr14, .ENr13, .ENr12, .ENr11: return "Poppins-Regular" + case .ENm32, .ENm28, .ENm24, .ENm20, .ENm18, .ENm16, .ENm15, .ENm14, .ENm13, .ENm12, .ENm11: return "Poppins-Medium" + case .ENb32, .ENb28, .ENb24, .ENb20, .ENb18, .ENb16, .ENb15, .ENb14, .ENb13, .ENb12, .ENb11: return "Poppins-Bold" + } + } +} + +// MARK: - Font line height +extension PPFontStyle { + /// 폰트 패밀리 행간 배율 + public var lineHeightMultiple: CGFloat { + switch self { + case .KOl28, .KOl24, .KOl20, .KOl18, .KOl16, .KOl15, .KOl14, .KOl13, .KOl12, .KOl11, + .KOr28, .KOr24, .KOr20, .KOr18, .KOr16, .KOr15, .KOr14, .KOr13, .KOr12, .KOr11, + .KOm28, .KOm24, .KOm20, .KOm18, .KOm16, .KOm15, .KOm14, .KOm13, .KOm12, .KOm11: + return 1.5 + + case .KOl32, .KOr32, .KOm32, .KOb32, .KOb28, .KOb24, .KOb20, .KOb18, .KOb16, .KOb15, .KOb14, .KOb13, .KOb12, .KOb11: + return 1.4 + + case .ENl32, .ENl28, .ENl24, .ENl20, .ENl18, .ENl16, .ENl15, .ENl14, .ENl13, .ENl12, .ENl11, + .ENr32, .ENr28, .ENr24, .ENr20, .ENr18, .ENr16, .ENr15, .ENr14, .ENr13, .ENr12, .ENr11, + .ENm32, .ENm28, .ENm24, .ENm20, .ENm18, .ENm16, .ENm15, .ENm14, .ENm13, .ENm12, .ENm11, + .ENb32, .ENb28, .ENb24, .ENb20, .ENb18, .ENb16, .ENb15, .ENb14, .ENb13, .ENb12, .ENb11: + return 1.35 + } + } + + /// 폰트 패밀리 행간 + public var lineHeight: CGFloat { + return (size * lineHeightMultiple).rounded() + } + + public var baseLineOffset: CGFloat { + if #available(iOS 16.4, *) { + return fontName.hasPrefix("Poppins") + ? (lineHeight - size + UIFont.PPFont(style: self).descender) / 2 + : (lineHeight - size) / 2 + } else { + return fontName.hasPrefix("Poppins") + ? (lineHeight - size + UIFont.PPFont(style: self).descender) / 4 + : (lineHeight - size) / 4 + } + } +} diff --git a/Poppool/PresentationLayer/LoginFeature/LoginFeature/Login/LastLoginView.swift b/Poppool/PresentationLayer/LoginFeature/LoginFeature/Login/LastLoginView.swift index 7a43ada4..5c5e61d0 100644 --- a/Poppool/PresentationLayer/LoginFeature/LoginFeature/Login/LastLoginView.swift +++ b/Poppool/PresentationLayer/LoginFeature/LoginFeature/Login/LastLoginView.swift @@ -1,5 +1,6 @@ import UIKit +import DesignSystem import SnapKit final class LastLoginView: UIView { @@ -37,11 +38,10 @@ final class LastLoginView: UIView { return UIView() }() - private let notificationLabel: UILabel = { - let label = UILabel() - label.font = .korFont(style: .medium, size: 13) - return label - }() + private let notificationLabel = PPLabel( + text: "최근에 이 방법으로 로그인했어요", + style: .KOm13 + ) private var colorType: TipColor { didSet { @@ -61,13 +61,13 @@ final class LastLoginView: UIView { /// - Parameters: /// - colorType: 툴팁의 색상(UIColor)을 인자로 받습니다 - w100, blu500 /// - direction: 툴팁의 방향을 인자로 받습니다 - up / down - init(colorType: TipColor, direction: TipDirection, text: String?) { + init(colorType: TipColor, direction: TipDirection) { self.colorType = colorType self.direction = direction super.init(frame: .zero) + setupLayer(color: colorType) notificationLabel.textColor = colorType.textColor - notificationLabel.text = text } required init?(coder: NSCoder) { @@ -97,13 +97,13 @@ extension LastLoginView { case .pointUp: notificationLabel.snp.makeConstraints { make in make.leading.trailing.equalToSuperview().inset(16) - make.bottom.equalToSuperview().inset(11) + make.bottom.equalToSuperview().inset(8) } case .pointDown: notificationLabel.snp.makeConstraints { make in - make.leading.trailing.equalToSuperview().inset(16) - make.top.equalToSuperview().inset(11) + make.horizontalEdges.equalToSuperview().inset(16) + make.top.equalToSuperview().inset(8) } } } @@ -191,13 +191,15 @@ extension LastLoginView { extension UIView { func showToolTip( color: LastLoginView.TipColor, - direction: LastLoginView.TipDirection, - text: String? = "최근에 이 방법으로 로그인했어요" + direction: LastLoginView.TipDirection ) { // 호출하는 컴포넌트 위 또는 아래에 생성되기 위해 superview를 구합니다 guard let superview = self.superview else { return } - let toolTip = LastLoginView(colorType: color, direction: direction, text: text) + let toolTip = LastLoginView( + colorType: color, + direction: direction + ) let beforeToolTip = superview.subviews.filter { $0 is LastLoginView } beforeToolTip.forEach { $0.removeFromSuperview() } diff --git a/Poppool/PresentationLayer/LoginFeature/LoginFeature/Login/LoginView.swift b/Poppool/PresentationLayer/LoginFeature/LoginFeature/Login/LoginView.swift index e24e2273..8d124c88 100644 --- a/Poppool/PresentationLayer/LoginFeature/LoginFeature/Login/LoginView.swift +++ b/Poppool/PresentationLayer/LoginFeature/LoginFeature/Login/LoginView.swift @@ -27,7 +27,10 @@ final class LoginView: UIView { $0.contentMode = .scaleAspectFit } - let titleLabel = PPLabel() + let titleLabel = PPLabel(style: .KOb16).then { + $0.textAlignment = .center + $0.numberOfLines = 0 + } let kakaoButton = PPButton(style: .kakao, text: "카카오톡으로 로그인") @@ -138,13 +141,7 @@ private extension LoginView { extension LoginView { func setTitle(_ title: String) { - self.titleLabel.setLineHeightText( - text: title, - font: .korFont(style: .bold, size: 16), - lineHeight: 1.3 - ) - self.titleLabel.numberOfLines = 0 - self.titleLabel.textAlignment = .center + self.titleLabel.updateText(to: title) } func setCloseButton(for loginSceneType: LoginSceneType) { diff --git a/Poppool/PresentationLayer/Presentation/Presentation/Scene/Comment/CommentCheck/CommentCheckView.swift b/Poppool/PresentationLayer/Presentation/Presentation/Scene/Comment/CommentCheck/CommentCheckView.swift index 610435fd..6cb2fbae 100644 --- a/Poppool/PresentationLayer/Presentation/Presentation/Scene/Comment/CommentCheck/CommentCheckView.swift +++ b/Poppool/PresentationLayer/Presentation/Presentation/Scene/Comment/CommentCheck/CommentCheckView.swift @@ -3,19 +3,21 @@ import UIKit import DesignSystem import SnapKit +import Then final class CommentCheckView: UIView { // MARK: - Components private let titleLabel: PPLabel = { - return PPLabel(style: .bold, fontSize: 18, text: "코멘트 작성을 그만하시겠어요?") + return PPLabel(text: "코멘트 작성을 그만하시겠어요?", style: .KOb18) }() - private let descriptionLabel: PPLabel = { - let label = PPLabel(style: .regular, fontSize: 14, text: "화면을 나가실 경우 작성중인 내용은 저장되지 않아요.") - label.textColor = .g600 - return label - }() + private let descriptionLabel = PPLabel( + text: "화면을 나가실 경우 작성중인 내용은 저장되지 않아요.", + style: .KOr14 + ).then { + $0.textColor = .g600 + } private let buttonStackView: UIStackView = { let view = UIStackView() @@ -25,11 +27,11 @@ final class CommentCheckView: UIView { }() let continueButton: PPButton = { - return PPButton(style: .secondary, text: "계속하기") + return PPButton(buttonStyle: .secondary, text: "계속하기") }() let stopButton: PPButton = { - return PPButton(style: .primary, text: "그만하기") + return PPButton(buttonStyle: .primary, text: "그만하기") }() // MARK: - init diff --git a/Poppool/PresentationLayer/Presentation/Presentation/Scene/Comment/CommentDetail/View/CommentDetailContentSection/CommentDetailContentSectionCell.swift b/Poppool/PresentationLayer/Presentation/Presentation/Scene/Comment/CommentDetail/View/CommentDetailContentSection/CommentDetailContentSectionCell.swift index 96bea9e7..00d8ff5c 100644 --- a/Poppool/PresentationLayer/Presentation/Presentation/Scene/Comment/CommentDetail/View/CommentDetailContentSection/CommentDetailContentSectionCell.swift +++ b/Poppool/PresentationLayer/Presentation/Presentation/Scene/Comment/CommentDetail/View/CommentDetailContentSection/CommentDetailContentSectionCell.swift @@ -4,16 +4,15 @@ import DesignSystem import RxSwift import SnapKit +import Then final class CommentDetailContentSectionCell: UICollectionViewCell { // MARK: - Components - private let contentLabel: PPLabel = { - let label = PPLabel(style: .medium, fontSize: 13) - label.numberOfLines = 0 - return label - }() + private let contentLabel = PPLabel(style: .KOm13).then { + $0.numberOfLines = 0 + } let disposeBag = DisposeBag() // MARK: - init @@ -44,6 +43,6 @@ extension CommentDetailContentSectionCell: Inputable { } func injection(with input: Input) { - contentLabel.setLineHeightText(text: input.content, font: .korFont(style: .medium, size: 13)) + contentLabel.updateText(to: input.content) } } diff --git a/Poppool/PresentationLayer/Presentation/Presentation/Scene/Home/Main/View/HomeHeaderView.swift b/Poppool/PresentationLayer/Presentation/Presentation/Scene/Home/Main/View/HomeHeaderView.swift index 28dac37a..ee7b10ff 100644 --- a/Poppool/PresentationLayer/Presentation/Presentation/Scene/Home/Main/View/HomeHeaderView.swift +++ b/Poppool/PresentationLayer/Presentation/Presentation/Scene/Home/Main/View/HomeHeaderView.swift @@ -3,6 +3,7 @@ import UIKit import DesignSystem import SnapKit +import Then final class HomeHeaderView: UIView { @@ -23,12 +24,13 @@ final class HomeHeaderView: UIView { return view }() - private let searchLabel: PPLabel = { - let label = PPLabel(style: .regular, fontSize: 14, text: "팝업스토어명을 입력해보세요") - label.textColor = .g1000 - label.isUserInteractionEnabled = false - return label - }() + private let searchLabel = PPLabel( + text: "팝업스토어명을 입력해보세요", + style: .KOr14 + ).then { + $0.textColor = .g1000 + $0.isUserInteractionEnabled = false + } // MARK: - init init() { diff --git a/Poppool/PresentationLayer/Presentation/Presentation/Scene/Home/Main/View/HomePopularCardSection/HomePopularCardSectionCell.swift b/Poppool/PresentationLayer/Presentation/Presentation/Scene/Home/Main/View/HomePopularCardSection/HomePopularCardSectionCell.swift index a7f8816f..8be51fa5 100644 --- a/Poppool/PresentationLayer/Presentation/Presentation/Scene/Home/Main/View/HomePopularCardSection/HomePopularCardSectionCell.swift +++ b/Poppool/PresentationLayer/Presentation/Presentation/Scene/Home/Main/View/HomePopularCardSection/HomePopularCardSectionCell.swift @@ -31,31 +31,23 @@ final class HomePopularCardSectionCell: UICollectionViewCell { return view }() - private let dateLabel: PPLabel = { - let label = PPLabel(style: .regular, fontSize: 16) - label.textColor = .w100 - return label - }() + private let dateLabel = PPLabel(style: .KOr16).then { + $0.textColor = .w100 + } - private let categoryLabel: PPLabel = { - let label = PPLabel(style: .regular, fontSize: 16) - label.textColor = .g1000 - label.backgroundColor = .w100 - return label - }() + private let categoryLabel = PPLabel(style: .KOr16).then { + $0.textColor = .g1000 + $0.backgroundColor = .w100 + } - private let titleLabel: PPLabel = { - let label = PPLabel(style: .regular, fontSize: 16) - label.numberOfLines = 2 - label.textColor = .w100 - return label - }() + private let titleLabel = PPLabel(style: .KOr16).then { + $0.numberOfLines = 2 + $0.textColor = .w100 + } - private let locationLabel: PPLabel = { - let label = PPLabel(style: .regular, fontSize: 16) - label.textColor = .w100 - return label - }() + private let locationLabel = PPLabel(style: .KOr16).then { + $0.textColor = .w100 + } let disposeBag = DisposeBag() @@ -127,7 +119,8 @@ extension HomePopularCardSectionCell: Inputable { func injection(with input: Input) { let date = "#\(input.endDate.toDate().toPPDateMonthString())까지 열리는" - dateLabel.setLineHeightText(text: date, font: .korFont(style: .regular, size: 16)) + dateLabel.updateText(to: date) + let category = "#\(input.category ?? "")" if let addressArray = input.address?.components(separatedBy: " ") { if addressArray.count > 2 { @@ -136,8 +129,8 @@ extension HomePopularCardSectionCell: Inputable { } } - categoryLabel.text = category - titleLabel.setLineHeightText(text: input.title, font: .korFont(style: .regular, size: 16)) + categoryLabel.updateText(to: category) + titleLabel.updateText(to: input.title) backGroundImageView.setPPImage(path: input.imagePath) } } diff --git a/Poppool/PresentationLayer/Presentation/Presentation/Scene/Map/FillterSheetView/FilterChip.swift b/Poppool/PresentationLayer/Presentation/Presentation/Scene/Map/FillterSheetView/FilterChip.swift index ec0fa088..a030bc0d 100644 --- a/Poppool/PresentationLayer/Presentation/Presentation/Scene/Map/FillterSheetView/FilterChip.swift +++ b/Poppool/PresentationLayer/Presentation/Presentation/Scene/Map/FillterSheetView/FilterChip.swift @@ -46,8 +46,6 @@ final class FilterChip: UIButton { // MARK: - Configuration func setTitle(_ title: String, style: Style) { - setTitle(title, for: .normal) - titleLabel?.font = .systemFont(ofSize: 14, weight: .bold) switch style { case .inactive: @@ -73,6 +71,8 @@ final class FilterChip: UIButton { let rightPadding: CGFloat = closeButton.isHidden ? 12 : 34 contentEdgeInsets = UIEdgeInsets(top: 5, left: 12, bottom: 7, right: rightPadding) + + self.setText(to: title, with: .KOb14, for: .normal) } // MARK: - Actions diff --git a/Poppool/PresentationLayer/Presentation/Presentation/Scene/Map/FillterSheetView/FilterChipsView.swift b/Poppool/PresentationLayer/Presentation/Presentation/Scene/Map/FillterSheetView/FilterChipsView.swift index 03c81149..4addedff 100644 --- a/Poppool/PresentationLayer/Presentation/Presentation/Scene/Map/FillterSheetView/FilterChipsView.swift +++ b/Poppool/PresentationLayer/Presentation/Presentation/Scene/Map/FillterSheetView/FilterChipsView.swift @@ -7,12 +7,9 @@ import SnapKit final class FilterChipsView: UIView { // MARK: - Components var onRemoveChip: ((String) -> Void)? - private let titleLabel: PPLabel = { - let label = PPLabel(style: .regular, fontSize: 13) - label.text = "선택한 옵션" - label.textColor = .g200 - return label - }() + private let titleLabel = PPLabel(text: "선택한 옵션", style: .KOr13).then { + $0.textColor = .g200 + } private lazy var collectionView: UICollectionView = { let layout = UICollectionViewFlowLayout() @@ -28,15 +25,11 @@ final class FilterChipsView: UIView { return collectionView }() - private let emptyStateLabel: UILabel = { - let label = UILabel() - label.text = "선택한 옵션이 없어요 :)" - label.textColor = .g300 - label.font = UIFont.systemFont(ofSize: 14, weight: .medium) - label.textAlignment = .center - label.isHidden = true // 초기에는 숨김 상태 - return label - }() + private let emptyStateLabel = PPLabel(text: "선택한 옵션이 없어요 :)", style: .KOm14).then { + $0.textColor = .g300 + $0.textAlignment = .center + $0.isHidden = true // 초기에는 숨김 상태 + } private var filters: [String] = [] diff --git a/Poppool/PresentationLayer/Presentation/Presentation/Scene/Map/StoreListView/StoreListCell.swift b/Poppool/PresentationLayer/Presentation/Presentation/Scene/Map/StoreListView/StoreListCell.swift index bdfb71b8..634ef367 100644 --- a/Poppool/PresentationLayer/Presentation/Presentation/Scene/Map/StoreListView/StoreListCell.swift +++ b/Poppool/PresentationLayer/Presentation/Presentation/Scene/Map/StoreListView/StoreListCell.swift @@ -5,6 +5,7 @@ import DesignSystem import ReactorKit import RxSwift import SnapKit +import Then final class StoreListCell: UICollectionViewCell { static let identifier = "StoreListCell" @@ -27,39 +28,31 @@ final class StoreListCell: UICollectionViewCell { return button }() - private let categoryTagLabel: PPLabel = { - let label = PPLabel(style: .bold, fontSize: 11, text: "") - label.textColor = .blu500 - label.text = "#카테고리" - return label - }() + private let categoryTagLabel = PPLabel(style: .KOb11).then { + $0.textColor = .blu500 + } - private let titleLabel: PPLabel = { - let label = PPLabel(style: .bold, fontSize: 14, text: "") - label.textColor = .g900 - label.numberOfLines = 2 - return label - }() + private let titleLabel = PPLabel(style: .KOb14).then { + $0.textColor = .g900 + $0.numberOfLines = 2 + } - private let locationLabel: PPLabel = { - let label = PPLabel(style: .medium, fontSize: 11, text: "") - label.textColor = .g400 - label.numberOfLines = 2 - return label - }() + private let locationLabel = PPLabel(style: .KOm11).then { + $0.textColor = .g400 + $0.numberOfLines = 2 + } - private let dateLabel: PPLabel = { - let label = PPLabel(style: .regular, fontSize: 12, text: "") - label.textColor = .g400 - label.numberOfLines = 2 - return label - }() + private let dateLabel = PPLabel(style: .KOr12).then { + $0.textColor = .g400 + $0.numberOfLines = 2 + } var disposeBag = DisposeBag() // MARK: - Init override init(frame: CGRect) { super.init(frame: frame) + setUpConstraints() configureUI() } @@ -137,13 +130,12 @@ extension StoreListCell: Inputable { func injection(with input: Input) { thumbnailImageView.setPPImage(path: input.thumbnailURL) - categoryTagLabel.text = "#\(input.category)" - titleLabel.text = input.title - locationLabel.text = input.location - dateLabel.text = input.date + categoryTagLabel.updateText(to: "#\(input.category)") + titleLabel.updateText(to: input.title) + locationLabel.updateText(to: input.location) + dateLabel.updateText(to: input.date) let bookmarkImage = input.isBookmarked ? "icon_bookmark_fill" : "icon_bookmark" bookmarkButton.setImage(UIImage(named: bookmarkImage), for: .normal) } - } diff --git a/Poppool/PresentationLayer/SearchFeature/SearchFeature/CatagorySelect/View/CategorySelectView.swift b/Poppool/PresentationLayer/SearchFeature/SearchFeature/CatagorySelect/View/CategorySelectView.swift index 0dcdd526..b2a709c1 100644 --- a/Poppool/PresentationLayer/SearchFeature/SearchFeature/CatagorySelect/View/CategorySelectView.swift +++ b/Poppool/PresentationLayer/SearchFeature/SearchFeature/CatagorySelect/View/CategorySelectView.swift @@ -8,9 +8,7 @@ import Then final class CategorySelectView: UIView { // MARK: - Components - private let titleLabel: PPLabel = { - return PPLabel(style: .bold, fontSize: 18, text: "카테고리를 선택해주세요") - }() + private let titleLabel = PPLabel(text: "카테고리를 선택해주세요", style: .KOb18) let closeButton = UIButton().then { $0.setImage(UIImage(named: "icon_xmark"), for: .normal) diff --git a/Poppool/PresentationLayer/SearchFeature/SearchFeature/Common/View/Component/TagCollectionHeaderView.swift b/Poppool/PresentationLayer/SearchFeature/SearchFeature/Common/View/Component/TagCollectionHeaderView.swift index 99425b24..93f9c5d0 100644 --- a/Poppool/PresentationLayer/SearchFeature/SearchFeature/Common/View/Component/TagCollectionHeaderView.swift +++ b/Poppool/PresentationLayer/SearchFeature/SearchFeature/Common/View/Component/TagCollectionHeaderView.swift @@ -10,13 +10,15 @@ final class TagCollectionHeaderView: UICollectionReusableView { // MARK: - Components var disposeBag = DisposeBag() - private let sectionTitleLabel = UILabel().then { - $0.font = .korFont(style: .bold, size: 16) - } + private let sectionTitleLabel = PPLabel(text: "최근 검색어", style: .KOb16) let removeAllButton = UIButton().then { $0.isHidden = true + $0.setText(to: "모두삭제", with: .KOr13) + } + private let removeAllButtonUnderline = UIView().then { + $0.backgroundColor = .g1000 } // MARK: - init @@ -43,6 +45,10 @@ private extension TagCollectionHeaderView { [sectionTitleLabel, removeAllButton].forEach { self.addSubview($0) } + + [removeAllButtonUnderline].forEach { + removeAllButton.addSubview($0) + } } func setupConstraints() { @@ -57,20 +63,18 @@ private extension TagCollectionHeaderView { make.centerY.equalTo(sectionTitleLabel) make.height.equalTo(20) } + + removeAllButtonUnderline.snp.makeConstraints { make in + make.height.equalTo(1) + make.bottom.equalToSuperview() + make.horizontalEdges.equalToSuperview() + } } } extension TagCollectionHeaderView { - func configureHeader(title: String, buttonTitle: String? = nil) { - sectionTitleLabel.text = title - if let buttonTitle = buttonTitle { - removeAllButton.isHidden = false - let attributes: [NSAttributedString.Key: Any] = [ - .underlineStyle: NSUnderlineStyle.single.rawValue, - .font: UIFont.korFont(style: .regular, size: 13) - ] - let attributedTitle = NSAttributedString(string: buttonTitle, attributes: attributes) - removeAllButton.setAttributedTitle(attributedTitle, for: .normal) - } + func configureHeader(title: String, showRemoveAllButton: Bool = false) { + sectionTitleLabel.updateText(to: title) + removeAllButton.isHidden = !showRemoveAllButton } } diff --git a/Poppool/PresentationLayer/SearchFeature/SearchFeature/FilterSelector/View/FilterSelectView.swift b/Poppool/PresentationLayer/SearchFeature/SearchFeature/FilterSelector/View/FilterSelectView.swift index efbbb69a..8984f08f 100644 --- a/Poppool/PresentationLayer/SearchFeature/SearchFeature/FilterSelector/View/FilterSelectView.swift +++ b/Poppool/PresentationLayer/SearchFeature/SearchFeature/FilterSelector/View/FilterSelectView.swift @@ -7,17 +7,17 @@ import SnapKit final class FilterSelectView: UIView { // MARK: - Components - private let titleLabel = PPLabel(style: .bold, fontSize: 18, text: "노출 순서를 선택해주세요") + private let titleLabel = PPLabel(text: "노출 순서를 선택해주세요", style: .KOb18) let closeButton = UIButton().then { $0.setImage(UIImage(named: "icon_xmark"), for: .normal) } - private let statusLabel = PPLabel(style: .regular, fontSize: 13, text: "노출 조건") + private let statusLabel = PPLabel(text: "노출 조건", style: .KOr13) let statusSegmentControl = PPSegmentedControl(type: .base, segments: ["오픈", "종료"], selectedSegmentIndex: 0) - private let sortLabel = PPLabel(style: .regular, fontSize: 13, text: "팝업순서") + private let sortLabel = PPLabel(text: "팝업순서", style: .KOr13) let sortSegmentControl = PPSegmentedControl(type: .base, segments: ["신규순", "인기순"], selectedSegmentIndex: 0) diff --git a/Poppool/PresentationLayer/SearchFeature/SearchFeature/PopupSearch/View/Component/Cell/SearchResultEmptyCollectionViewCell.swift b/Poppool/PresentationLayer/SearchFeature/SearchFeature/PopupSearch/View/Component/Cell/SearchResultEmptyCollectionViewCell.swift index 9a82752c..6aa77f23 100644 --- a/Poppool/PresentationLayer/SearchFeature/SearchFeature/PopupSearch/View/Component/Cell/SearchResultEmptyCollectionViewCell.swift +++ b/Poppool/PresentationLayer/SearchFeature/SearchFeature/PopupSearch/View/Component/Cell/SearchResultEmptyCollectionViewCell.swift @@ -9,11 +9,7 @@ import Then final class SearchResultEmptyCollectionViewCell: UICollectionViewCell { // MARK: - Properties - private let emptyLabel = PPLabel( - style: .medium, - fontSize: 14, - lineHeight: 1.5 - ).then { + private let emptyLabel = PPLabel(style: .KOm14).then { $0.textAlignment = .center $0.numberOfLines = 2 $0.textColor = .g400 @@ -54,6 +50,6 @@ private extension SearchResultEmptyCollectionViewCell { extension SearchResultEmptyCollectionViewCell { func configureCell(title: String) { - self.emptyLabel.text = title + self.emptyLabel.updateText(to: title) } } diff --git a/Poppool/PresentationLayer/SearchFeature/SearchFeature/PopupSearch/View/Component/Cell/SearchResultHeaderCollectionViewCell.swift b/Poppool/PresentationLayer/SearchFeature/SearchFeature/PopupSearch/View/Component/Cell/SearchResultHeaderCollectionViewCell.swift index 518bac1a..dfc96e35 100644 --- a/Poppool/PresentationLayer/SearchFeature/SearchFeature/PopupSearch/View/Component/Cell/SearchResultHeaderCollectionViewCell.swift +++ b/Poppool/PresentationLayer/SearchFeature/SearchFeature/PopupSearch/View/Component/Cell/SearchResultHeaderCollectionViewCell.swift @@ -12,15 +12,15 @@ public final class SearchResultHeaderCollectionViewCell: UICollectionViewCell { var disposeBag = DisposeBag() - private let afterSearchTitleLabel = PPLabel(style: .bold, fontSize: 16).then { + private let afterSearchTitleLabel = PPLabel(style: .KOb16).then { $0.isHidden = true } - private let cellCountLabel = PPLabel(style: .regular, fontSize: 13).then { + private let cellCountLabel = PPLabel(style: .KOr13).then { $0.textColor = .g400 } - private let filterStatusLabel = PPLabel(style: .regular, fontSize: 13) + private let filterStatusLabel = PPLabel(style: .KOr13) private let dropDownImageView = UIImageView().then { $0.image = UIImage(named: "icon_dropdown") @@ -100,8 +100,8 @@ extension SearchResultHeaderCollectionViewCell { let count = count { filterStatusButton.isHidden = true afterSearchTitleLabel.isHidden = false - afterSearchTitleLabel.text = afterSearchTitle + " 포함된 팝업" - cellCountLabel.text = "총 \(count)개를 찾았어요." + afterSearchTitleLabel.updateText(to: afterSearchTitle + " 포함된 팝업") + cellCountLabel.updateText(to: "총 \(count)개를 찾았어요.") if count == 0 { self.isHidden = true } else { self.isHidden = false @@ -113,8 +113,8 @@ extension SearchResultHeaderCollectionViewCell { } else if let count, let filterText { filterStatusButton.isHidden = false afterSearchTitleLabel.isHidden = true - cellCountLabel.text = "총 \(count)개" - filterStatusLabel.text = filterText + cellCountLabel.updateText(to: "총 \(count)개") + filterStatusLabel.updateText(to: filterText) self.isHidden = false afterSearchTitleLabel.snp.updateConstraints { make in diff --git a/Poppool/PresentationLayer/SearchFeature/SearchFeature/PopupSearch/View/PopupSearchView.swift b/Poppool/PresentationLayer/SearchFeature/SearchFeature/PopupSearch/View/PopupSearchView.swift index bcd5b3e8..eb93baf7 100644 --- a/Poppool/PresentationLayer/SearchFeature/SearchFeature/PopupSearch/View/PopupSearchView.swift +++ b/Poppool/PresentationLayer/SearchFeature/SearchFeature/PopupSearch/View/PopupSearchView.swift @@ -234,7 +234,7 @@ extension PopupSearchView { withReuseIdentifier: TagCollectionHeaderView.identifiers, for: indexPath ) as? TagCollectionHeaderView else { fatalError("\(#file), \(#function) Error") } - header.configureHeader(title: "최근 검색어", buttonTitle: "모두삭제") + header.configureHeader(title: "최근 검색어", showRemoveAllButton: true) header.removeAllButton.rx.tap .bind(to: self.recentSearchTagRemoveAllButtonTapped) diff --git a/Poppool/PresentationLayer/SearchFeature/SearchFeatureDemo/Resource/Info.plist b/Poppool/PresentationLayer/SearchFeature/SearchFeatureDemo/Resource/Info.plist index a343d54d..ade6bb80 100644 --- a/Poppool/PresentationLayer/SearchFeature/SearchFeatureDemo/Resource/Info.plist +++ b/Poppool/PresentationLayer/SearchFeature/SearchFeatureDemo/Resource/Info.plist @@ -2,6 +2,11 @@ + NSAppTransportSecurity + + NSAllowsArbitraryLoads + + UIUserInterfaceStyle Light UIAppFonts