Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[πŸŽ¨λ””μžμΈ μ‹œμŠ€ν…œπŸŽ¨] #19

Open
shippingpark opened this issue Nov 10, 2024 · 0 comments
Open

[πŸŽ¨λ””μžμΈ μ‹œμŠ€ν…œπŸŽ¨] #19

shippingpark opened this issue Nov 10, 2024 · 0 comments
Labels
Rule 악동쿠킀듀이 μ§€μΌœμ•Ό ν•  우리λ₯Ό μœ„ν•œ λ£°μž…λ‹ˆλ‹€

Comments

@shippingpark
Copy link
Collaborator

shippingpark commented Nov 10, 2024

🏷️ Description

DesignSystem ν•˜μœ„ ν΄λ”μ—μ„œ ν•΄λ‹Ή λ‚΄μš©μ„ 확인할 수 μžˆμŠ΅λ‹ˆλ‹€

🎨 λ””μžμΈ μ‹œμŠ€ν…œ

Spacing

extension CGFloat {
  struct AK {
    static let commonHorizontal: CGFloat = 25.0
  }
}

constraints μž‘μ„± μ‹œ λ””μžμΈκ°€μ΄λ“œμ— 영ν–₯을 λ°›λŠ” Spacing인지 κ³ λ €ν•©λ‹ˆλ‹€.
곡톡 양식을 λ”°λ₯΄λŠ” 값이라면 DesingSystem에 λͺ…μ‹œλœ Spacing을 따라 μž‘μ„±ν•˜κ³ ,
ν•΄λ‹Ή 값이 λ³€λ™λ˜λ©΄ μ•±μ˜ λͺ¨λ“  λ·°κ°€ 변동 될 수 μžˆλ„λ‘ ν•©λ‹ˆλ‹€.

μ˜ˆμ‹œ
image
μœ„μ˜ tableViewλŠ” ν•΄λ‹Ή 뷰에 κ·€μ†λ˜λŠ” κ°œλ…μ΄ μ•„λ‹Œ 우리 μ•± μ„œλΉ„μŠ€μ˜ 일관성을 μœ„ν•œ 간격을 ν•„μš”λ‘œ ν•΄ λ³΄μž…λ‹ˆλ‹€.
κ·ΈλŸ¬λ‹ˆ 숫자λ₯Ό 직접 μž…λ ₯ν•˜λŠ” 것이 μ•„λ‹Œ(ν•˜λ“œμ½”λ”©) κΈ°λ³Έ Spacing 을 κΈ°μž…ν•˜μ—¬ μΆ”ν›„ 변동에 λŒ€λΉ„ν•©λ‹ˆλ‹€
(쒌우 간격을 30으둜 λ„“νžˆλŠ” 결정을 ν•œλ‹€λ©΄ DesignSystem만 변경해주어도 되게)

NSLayoutConstraint.activate([
      travelTableView.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor),
      travelTableView.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: .AK.commonHorizontal),
      travelTableView.trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: -.AK.commonHorizontal),
      travelTableView.bottomAnchor.constraint(equalTo: view.bottomAnchor)
])

(μ˜€ν† λ ˆμ΄μ•„μ›ƒ κ³ λ―Ό μ‹œ)
image

μœ„μ˜ 타이틀이 λΆ€λͺ¨Viewλ‘œλΆ€ν„° λ–¨μ–΄μ Έμ•Ό ν•  값인지 TableViewλ‘œλΆ€ν„° λ–¨μ–΄μ Έμ•Ό ν•  값인지 κ³ λ―Όν•©λ‹ˆλ‹€.
DesignSystem 속 οΏ½Spacing이 λ³€κ²½λ˜λ©΄ Title의 μœ„μΉ˜λ˜ν•œ μžμ—°μŠ€λŸ½κ²Œ λ³€ν•˜κΈΈ λ°”λΌλŠ” 지 κ³ λ―Όν•΄ λ΄…λ‹ˆλ‹€.
μ μ ˆν•œ νŒλ‹¨ ν•˜μ— 기쀀을 작기 !

Color

extension UIColor {
  enum AkColorType: String {
    case white = "#FFFFFF"
    case gray1 = "#F1F1F1"
    case gray2 = "#B3B3B3"
    case gray3 = "#8E8E93"
    case black = "#000000"
    
    case akOrange = "#F64E05"
    case akGreen = "#DCED59"
    
    case akPurple = "#EFD0F4"
    case akSubGreen = "#E3F4DC"
    case akRed = "#FFD8D6"
    case akYellow = "#FFF4CA"
    case akBlue = "#D0E0F4"
  }
  
  static func akColor(_ type: AkColorType) -> UIColor {
    return UIColor(hexCode: type.rawValue)
  }
}

μœ„μ˜ λ©”μ„œλ“œλ₯Ό μ‚¬μš©ν•˜μ—¬ 색상을 μž…νž™λ‹ˆλ‹€.
악동 μΏ ν‚€λ“€ μ„œλΉ„μŠ€μ˜ λͺ¨λ“  화면은 μœ„μ˜ 색상 λΆ„λ₯˜λ§Œ μ‚¬μš©ν•©λ‹ˆλ‹€.
색상이 μΆ”κ°€λœλ‹€λ©΄ caseλ₯Ό μΆ”κ°€ν•©λ‹ˆλ‹€.

μ˜ˆμ‹œ

let titleLabel = UILabel().set {
    $0l.font = .akFont(.gmarketMedium30)
    $0.textColor = .akColor(.black)
    $0.adjustsFontForContentSizeCategory = true
  }

μœ„μ™€ 같은 View μ €μž₯속성 μž‘μ„± μ‹œ set λ©”μ„œλ“œλ₯Ό μ‚¬μš©ν•©λ‹ˆλ‹€
[Tip]
set λ©”μ„œλ“œ μ‚¬μš© μ‹œ $0..translatesAutoresizingMaskIntoConstraints = false λŠ” μžλ™μœΌλ‘œ 적용 λ©λ‹ˆλ‹€

Font

extension UIFont {
  static func akFont(_ type: AKFontType, dynamic: Bool = true) -> UIFont {
    guard let customFont = UIFont(name: type.customFont, size: type.size) else {
      return UIFont.systemFont(ofSize: type.size) // ν°νŠΈκ°€ μ—†λŠ” 경우 κΈ°λ³Έ μ‹œμŠ€ν…œ 폰트둜 λŒ€μ²΄
    }
    return dynamic ? UIFontMetrics.default.scaledFont(for: customFont) : customFont
  }
}

λ‹€μ΄λ‚˜λ―Ήν°νŠΈλ₯Ό κ΅¬ν˜„ν•˜κΈ° μœ„ν•΄, 폰트λ₯Ό λ°˜ν™˜ν•˜λŠ” acFont λ©”μ„œλ“œλŠ” μœ„μ™€ 같이 μž‘μ„±λ˜μ—ˆμŠ΅λ‹ˆλ‹€.

μ•„λž˜μ™€ 같이 μ‚¬μš©ν•˜λ©΄ λ©λ‹ˆλ‹€.

μ˜ˆμ‹œ

let titleLabel = UILabel().set {
    $0.font = .akFont(.gmarketMedium30)
    $0.textColor = .akColor(.black)
    $0.adjustsFontForContentSizeCategory = true // 🚨
  }

🚨주의🚨
λ‹€μ΄λ‚˜λ―Ή 폰트의 동적인 μ μš©μ„ μœ„ν•΄μ„œλŠ” μΆ”κ°€μ μœΌλ‘œ μ•„λž˜ μ˜΅μ…˜(adjustsFontForContentSizeCategory)을 true둜 μ„€μ •ν•΄μ•Ό ν•©λ‹ˆλ‹€

μ»€μŠ€ν…€ λ·° μž‘μ„± κ·œμΉ™

#17
λ§Žμ€ λ ˆμ΄μ•„μ›ƒ 관리, 독립적 행동을 ν•„μš”λ‘œ ν•˜λŠ” 경우 ν•΄λ‹Ή UIView ꡬ성 μ½”λ“œλŠ”
ViewController λ‚΄λΆ€λ‘œλΆ€ν„° λΆ„λ¦¬ν•˜μ—¬ UIViewλ₯Ό μƒμ†ν•œ νƒ€μž…(μ»€μŠ€ν…€ λ·°)을 μƒμ„±ν•©λ‹ˆλ‹€

@shippingpark shippingpark added the Rule 악동쿠킀듀이 μ§€μΌœμ•Ό ν•  우리λ₯Ό μœ„ν•œ λ£°μž…λ‹ˆλ‹€ label Nov 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Rule 악동쿠킀듀이 μ§€μΌœμ•Ό ν•  우리λ₯Ό μœ„ν•œ λ£°μž…λ‹ˆλ‹€
Projects
None yet
Development

No branches or pull requests

1 participant