Files
suixinkan_uikit/suixinkan/Theme/AppFont.swift
汉秋 87696a4774 Introduce unified design tokens and migrate Home, Orders, and Statistics UI.
Establish AppColor/AppFont/AppSpacing/AppRadius theming, shared components, and design-system docs so pilot screens align with Android while keeping iOS-native spacing and touch targets.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-06 17:58:18 +08:00

55 lines
1.3 KiB
Swift
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//
// AppFont.swift
// suixinkan
//
import UIKit
/// 8pt SF ProSystem
enum AppFont {
case caption
case captionMedium
case body
case bodyMedium
case subtitle
case title
case metric
case display
/// UIFont
var uiFont: UIFont {
switch self {
case .caption:
return .systemFont(ofSize: 12, weight: .regular)
case .captionMedium:
return .systemFont(ofSize: 12, weight: .medium)
case .body:
return .systemFont(ofSize: 14, weight: .regular)
case .bodyMedium:
return .systemFont(ofSize: 14, weight: .medium)
case .subtitle:
return .systemFont(ofSize: 16, weight: .medium)
case .title:
return .systemFont(ofSize: 16, weight: .bold)
case .metric:
return .systemFont(ofSize: 18, weight: .bold)
case .display:
return .systemFont(ofSize: 28, weight: .semibold)
}
}
/// UILabel
func apply(to label: UILabel) {
label.font = uiFont
}
}
extension UIFont {
/// `AppFont`
static func app(_ style: AppFont) -> UIFont {
style.uiFont
}
}