42 lines
1.6 KiB
Swift
42 lines
1.6 KiB
Swift
import SwiftUI
|
|
|
|
/// Semantic font helpers that scale with Dynamic Type.
|
|
/// Use these instead of `.font(.system(size: N))` for any text the user reads.
|
|
///
|
|
/// For UI chrome (icons, badges, timestamps) that must stay compact, `.system(size:)` is fine.
|
|
/// For song titles, artist names, album titles, and primary navigation text — use AppFont.
|
|
extension Font {
|
|
|
|
// MARK: - Now Playing
|
|
|
|
/// Song title in Now Playing — scales from ~17pt (small) to ~26pt (accessibility)
|
|
static var npTitle: Font { .system(.title2, design: .default, weight: .bold) }
|
|
|
|
/// Artist name in Now Playing
|
|
static var npArtist: Font { .system(.body, design: .default, weight: .regular) }
|
|
|
|
// MARK: - Library Lists
|
|
|
|
/// Primary row text — song/album/artist names in list cells
|
|
static var rowTitle: Font { .system(.body) }
|
|
|
|
/// Secondary row text — artist, album subtitle, metadata
|
|
static var rowSubtitle: Font { .system(.subheadline) }
|
|
|
|
/// Third-line metadata (duration, year, genre)
|
|
static var rowMeta: Font { .system(.caption) }
|
|
|
|
// MARK: - Navigation & Headers
|
|
|
|
/// Section headers in library views
|
|
static var sectionHeader: Font { .system(.headline) }
|
|
|
|
/// Navigation bar titles (SwiftUI handles this automatically, but for custom bars)
|
|
static var navTitle: Font { .system(.headline, weight: .semibold) }
|
|
|
|
// MARK: - Fixed-size UI Chrome (does NOT scale)
|
|
// Use for timestamps, badges, icons where layout must stay predictable.
|
|
static func fixed(_ size: CGFloat, weight: Font.Weight = .regular) -> Font {
|
|
.system(size: size, weight: weight)
|
|
}
|
|
}
|