Compare commits
No commits in common. "4d84e2ec140a76b163be405aef3a4b01bfec30c3" and "ce905431ed3bcacf749d1797e4d9afc62e4dcec2" have entirely different histories.
4d84e2ec14
...
ce905431ed
@ -107,7 +107,7 @@ struct MyView: View {
|
||||
var body: some View {
|
||||
VStack(spacing: Design.Spacing.medium) {
|
||||
Text("Hello")
|
||||
.font(.title)
|
||||
.font(.system(size: Design.BaseFontSize.title))
|
||||
.padding(Design.Spacing.large)
|
||||
|
||||
Button("Tap Me") { }
|
||||
|
||||
@ -190,24 +190,36 @@ public enum Design {
|
||||
|
||||
/// Standard icon sizes for SF Symbols and custom icons.
|
||||
public enum IconSize {
|
||||
/// Extra small icon (10pt) - tiny indicators.
|
||||
public static let xSmall: CGFloat = 10
|
||||
/// Small icon (12pt) - inline with caption text.
|
||||
public static let small: CGFloat = 12
|
||||
/// Medium icon (16pt) - inline with body text.
|
||||
public static let medium: CGFloat = 16
|
||||
/// Large icon (22pt) - standalone icons.
|
||||
public static let large: CGFloat = 22
|
||||
/// Extra large icon (28pt) - row icons, list items.
|
||||
public static let xLarge: CGFloat = 28
|
||||
/// Double extra large icon (36pt) - card icons, buttons.
|
||||
public static let xxLarge: CGFloat = 36
|
||||
/// Triple extra large icon (48pt) - feature icons.
|
||||
public static let xxxLarge: CGFloat = 48
|
||||
/// Display icon (64pt) - section headers, prominent features.
|
||||
public static let display: CGFloat = 64
|
||||
/// Hero icon (80pt) - empty states, splash screens.
|
||||
public static let hero: CGFloat = 80
|
||||
public static let xLarge: CGFloat = 32
|
||||
public static let xxLarge: CGFloat = 48
|
||||
public static let xxxLarge: CGFloat = 64
|
||||
}
|
||||
|
||||
// MARK: - Font Sizes (Base values for @ScaledMetric)
|
||||
|
||||
/// Base font sizes to use with @ScaledMetric for Dynamic Type support.
|
||||
public enum BaseFontSize {
|
||||
public static let xxSmall: CGFloat = 7
|
||||
public static let xSmall: CGFloat = 9
|
||||
public static let small: CGFloat = 10
|
||||
public static let caption: CGFloat = 11
|
||||
public static let body: CGFloat = 12
|
||||
public static let callout: CGFloat = 13
|
||||
public static let medium: CGFloat = 14
|
||||
public static let subheadline: CGFloat = 15
|
||||
public static let large: CGFloat = 16
|
||||
public static let xLarge: CGFloat = 18
|
||||
public static let xxLarge: CGFloat = 20
|
||||
public static let title3: CGFloat = 22
|
||||
public static let title2: CGFloat = 26
|
||||
public static let title: CGFloat = 32
|
||||
public static let largeTitle: CGFloat = 36
|
||||
public static let display: CGFloat = 48
|
||||
public static let hero: CGFloat = 64
|
||||
}
|
||||
|
||||
// MARK: - Scale
|
||||
|
||||
@ -37,8 +37,7 @@ public struct BadgePill: View {
|
||||
|
||||
public var body: some View {
|
||||
Text(text)
|
||||
.font(.subheadline.weight(.bold))
|
||||
.fontDesign(.rounded)
|
||||
.font(.system(size: Design.BaseFontSize.body, weight: .bold, design: .rounded))
|
||||
.foregroundStyle(isSelected ? .black : accentColor)
|
||||
.padding(.horizontal, Design.Spacing.small)
|
||||
.padding(.vertical, Design.Spacing.xSmall)
|
||||
|
||||
@ -76,16 +76,16 @@ public struct LicensesView: View {
|
||||
SettingsCard(backgroundColor: cardBackgroundColor, borderColor: cardBorderColor) {
|
||||
VStack(alignment: .leading, spacing: Design.Spacing.small) {
|
||||
Text(license.name)
|
||||
.font(.subheadline.weight(.bold))
|
||||
.font(.system(size: Design.BaseFontSize.medium, weight: .bold))
|
||||
.foregroundStyle(.white)
|
||||
|
||||
Text(license.description)
|
||||
.font(.caption)
|
||||
.font(.system(size: Design.BaseFontSize.caption))
|
||||
.foregroundStyle(.white.opacity(Design.Opacity.strong))
|
||||
|
||||
HStack {
|
||||
Label(license.licenseType, systemImage: "doc.text")
|
||||
.font(.caption2)
|
||||
.font(.system(size: Design.BaseFontSize.xSmall))
|
||||
.foregroundStyle(accentColor)
|
||||
|
||||
Spacer()
|
||||
@ -93,7 +93,7 @@ public struct LicensesView: View {
|
||||
if let linkURL = URL(string: license.url) {
|
||||
Link(destination: linkURL) {
|
||||
Label(String(localized: "View on GitHub"), systemImage: "arrow.up.right.square")
|
||||
.font(.caption2)
|
||||
.font(.system(size: Design.BaseFontSize.xSmall))
|
||||
.foregroundStyle(accentColor)
|
||||
}
|
||||
}
|
||||
|
||||
@ -316,16 +316,16 @@ Toggle(isOn: $isOn) {
|
||||
VStack(alignment: .leading, spacing: Design.Spacing.xxSmall) {
|
||||
HStack(spacing: Design.Spacing.xSmall) {
|
||||
Text(title)
|
||||
.font(.subheadline.weight(.medium))
|
||||
.font(.system(size: Design.BaseFontSize.medium, weight: .medium))
|
||||
.foregroundStyle(.white)
|
||||
|
||||
Image(systemName: "crown.fill")
|
||||
.font(.caption2)
|
||||
.font(.system(size: Design.BaseFontSize.small))
|
||||
.foregroundStyle(AppStatus.warning)
|
||||
}
|
||||
|
||||
Text(subtitle)
|
||||
.font(.subheadline)
|
||||
.font(.system(size: Design.BaseFontSize.body))
|
||||
.foregroundStyle(.white.opacity(Design.Opacity.medium))
|
||||
}
|
||||
}
|
||||
@ -391,29 +391,28 @@ SettingsSlider(
|
||||
VStack(alignment: .leading, spacing: Design.Spacing.small) {
|
||||
HStack {
|
||||
Text("Ring Size")
|
||||
.font(.subheadline.weight(.medium))
|
||||
.font(.system(size: Design.BaseFontSize.medium, weight: .medium))
|
||||
.foregroundStyle(.white)
|
||||
Spacer()
|
||||
Text("\(Int(viewModel.ringSize))pt")
|
||||
.font(.subheadline.weight(.medium))
|
||||
.fontDesign(.rounded)
|
||||
.font(.system(size: Design.BaseFontSize.body, weight: .medium, design: .rounded))
|
||||
.foregroundStyle(.white.opacity(Design.Opacity.medium))
|
||||
}
|
||||
|
||||
Text("Adjusts the size of the ring")
|
||||
.font(.caption)
|
||||
.font(.system(size: Design.BaseFontSize.caption))
|
||||
.foregroundStyle(.white.opacity(Design.Opacity.medium))
|
||||
|
||||
HStack(spacing: Design.Spacing.medium) {
|
||||
Image(systemName: "circle")
|
||||
.font(.caption2)
|
||||
.font(.system(size: Design.BaseFontSize.small))
|
||||
.foregroundStyle(.white.opacity(Design.Opacity.medium))
|
||||
|
||||
Slider(value: $viewModel.ringSize, in: 20...100, step: 5)
|
||||
.tint(AppAccent.primary)
|
||||
|
||||
Image(systemName: "circle")
|
||||
.font(.callout)
|
||||
.font(.system(size: Design.BaseFontSize.large))
|
||||
.foregroundStyle(.white.opacity(Design.Opacity.medium))
|
||||
}
|
||||
}
|
||||
@ -459,18 +458,18 @@ NavigationLink {
|
||||
HStack {
|
||||
VStack(alignment: .leading, spacing: Design.Spacing.xxSmall) {
|
||||
Text("Open Source Licenses")
|
||||
.font(.subheadline.weight(.medium))
|
||||
.font(.system(size: Design.BaseFontSize.body, weight: .medium))
|
||||
.foregroundStyle(.white)
|
||||
|
||||
Text("Third-party libraries used in this app")
|
||||
.font(.caption)
|
||||
.font(.system(size: Design.BaseFontSize.caption))
|
||||
.foregroundStyle(.white.opacity(Design.Opacity.medium))
|
||||
}
|
||||
|
||||
Spacer()
|
||||
|
||||
Image(systemName: "chevron.right")
|
||||
.font(.caption)
|
||||
.font(.system(size: Design.BaseFontSize.caption))
|
||||
.foregroundStyle(.white.opacity(Design.Opacity.medium))
|
||||
}
|
||||
.padding(Design.Spacing.medium)
|
||||
@ -577,11 +576,11 @@ SettingsSegmentedPicker(
|
||||
// ❌ BEFORE: Inline title/subtitle with SegmentedPicker
|
||||
VStack(alignment: .leading, spacing: Design.Spacing.xxSmall) {
|
||||
Text("Camera")
|
||||
.font(.subheadline.weight(.medium))
|
||||
.font(.system(size: Design.BaseFontSize.medium, weight: .medium))
|
||||
.foregroundStyle(.white)
|
||||
|
||||
Text("Choose between front and back camera lenses")
|
||||
.font(.caption)
|
||||
.font(.system(size: Design.BaseFontSize.caption))
|
||||
.foregroundStyle(.white.opacity(Design.Opacity.medium))
|
||||
|
||||
SegmentedPicker(
|
||||
@ -924,7 +923,7 @@ SettingsView()
|
||||
|
||||
4. **Section-specific accents**: Use `AppStatus.warning` for premium sections, `AppStatus.error` for debug.
|
||||
|
||||
5. **Test with Dynamic Type**: Bedrock uses iOS semantic fonts (`.body`, `.caption`, etc.) that scale properly with Dynamic Type.
|
||||
5. **Test with Dynamic Type**: Bedrock uses `Design.BaseFontSize` values that scale properly.
|
||||
|
||||
6. **Avoid `Color.` typealiases**: Use `App`-prefixed typealiases to prevent conflicts with Bedrock's defaults.
|
||||
|
||||
|
||||
@ -52,7 +52,7 @@ public struct SegmentedPicker<T: Equatable>: View {
|
||||
public var body: some View {
|
||||
VStack(alignment: .leading, spacing: Design.Spacing.small) {
|
||||
Text(title)
|
||||
.font(.subheadline.weight(.medium))
|
||||
.font(.system(size: Design.BaseFontSize.medium, weight: .medium))
|
||||
.foregroundStyle(.white)
|
||||
|
||||
HStack(spacing: Design.Spacing.small) {
|
||||
@ -62,7 +62,7 @@ public struct SegmentedPicker<T: Equatable>: View {
|
||||
selection = option.1
|
||||
} label: {
|
||||
Text(option.0)
|
||||
.font(.subheadline.weight(.medium))
|
||||
.font(.system(size: Design.BaseFontSize.body, weight: .medium))
|
||||
.foregroundStyle(selection == option.1 ? .black : .white.opacity(Design.Opacity.strong))
|
||||
.padding(.vertical, Design.Spacing.small)
|
||||
.frame(maxWidth: .infinity)
|
||||
|
||||
@ -68,11 +68,11 @@ public struct SelectableRow<Badge: View>: View {
|
||||
HStack {
|
||||
VStack(alignment: .leading, spacing: Design.Spacing.xxSmall) {
|
||||
Text(title)
|
||||
.font(.callout.weight(.semibold))
|
||||
.font(.system(size: Design.BaseFontSize.large, weight: .semibold))
|
||||
.foregroundStyle(.white)
|
||||
|
||||
Text(subtitle)
|
||||
.font(.subheadline)
|
||||
.font(.system(size: Design.BaseFontSize.body))
|
||||
.foregroundStyle(.white.opacity(Design.Opacity.medium))
|
||||
}
|
||||
|
||||
|
||||
@ -68,12 +68,12 @@ public struct SettingsNavigationRow<Destination: View>: View {
|
||||
HStack {
|
||||
VStack(alignment: .leading, spacing: Design.Spacing.xxSmall) {
|
||||
Text(title)
|
||||
.font(.subheadline.weight(.medium))
|
||||
.font(.system(size: Design.BaseFontSize.body, weight: .medium))
|
||||
.foregroundStyle(.primary)
|
||||
|
||||
if let subtitle {
|
||||
Text(subtitle)
|
||||
.font(.caption)
|
||||
.font(.system(size: Design.BaseFontSize.caption))
|
||||
.foregroundStyle(.secondary)
|
||||
}
|
||||
}
|
||||
@ -81,7 +81,7 @@ public struct SettingsNavigationRow<Destination: View>: View {
|
||||
Spacer()
|
||||
|
||||
Image(systemName: "chevron.right")
|
||||
.font(.caption)
|
||||
.font(.system(size: Design.BaseFontSize.caption))
|
||||
.foregroundStyle(.secondary)
|
||||
}
|
||||
.padding(Design.Spacing.medium)
|
||||
|
||||
@ -55,21 +55,21 @@ public struct SettingsRow<Accessory: View>: View {
|
||||
Button(action: action) {
|
||||
HStack(spacing: Design.Spacing.medium) {
|
||||
Image(systemName: systemImage)
|
||||
.font(.subheadline)
|
||||
.font(.system(size: Design.BaseFontSize.medium))
|
||||
.foregroundStyle(.white)
|
||||
.frame(width: Design.Size.iconContainerSmall, height: Design.Size.iconContainerSmall)
|
||||
.background(iconColor.opacity(Design.Opacity.heavy))
|
||||
.clipShape(.rect(cornerRadius: Design.CornerRadius.xSmall))
|
||||
|
||||
Text(title)
|
||||
.font(.subheadline)
|
||||
.font(.system(size: Design.BaseFontSize.medium))
|
||||
.foregroundStyle(.primary)
|
||||
|
||||
Spacer()
|
||||
|
||||
if let value {
|
||||
Text(value)
|
||||
.font(.subheadline)
|
||||
.font(.system(size: Design.BaseFontSize.body))
|
||||
.foregroundStyle(.secondary)
|
||||
}
|
||||
|
||||
@ -77,7 +77,7 @@ public struct SettingsRow<Accessory: View>: View {
|
||||
accessory
|
||||
} else {
|
||||
Image(systemName: "chevron.right")
|
||||
.font(.subheadline.weight(.medium))
|
||||
.font(.system(size: Design.BaseFontSize.body, weight: .medium))
|
||||
.foregroundStyle(.tertiary)
|
||||
}
|
||||
}
|
||||
|
||||
@ -37,12 +37,12 @@ public struct SettingsSectionHeader: View {
|
||||
HStack(spacing: Design.Spacing.small) {
|
||||
if let systemImage {
|
||||
Image(systemName: systemImage)
|
||||
.font(.subheadline)
|
||||
.font(.system(size: Design.BaseFontSize.medium))
|
||||
.foregroundStyle(accentColor.opacity(Design.Opacity.strong))
|
||||
}
|
||||
|
||||
Text(title)
|
||||
.font(.caption.weight(.semibold))
|
||||
.font(.system(size: Design.BaseFontSize.caption, weight: .semibold))
|
||||
.foregroundStyle(.secondary)
|
||||
.textCase(.uppercase)
|
||||
.tracking(0.5)
|
||||
|
||||
@ -80,18 +80,18 @@ public struct SettingsSegmentedPicker<T: Equatable, Accessory: View>: View {
|
||||
// Title row with optional accessory
|
||||
HStack(spacing: Design.Spacing.xSmall) {
|
||||
Text(title)
|
||||
.font(.subheadline.weight(.medium))
|
||||
.font(.system(size: Design.BaseFontSize.medium, weight: .medium))
|
||||
.foregroundStyle(.primary)
|
||||
|
||||
if let titleAccessory {
|
||||
titleAccessory
|
||||
.font(.caption2)
|
||||
.font(.system(size: Design.BaseFontSize.small))
|
||||
}
|
||||
}
|
||||
|
||||
// Subtitle
|
||||
Text(subtitle)
|
||||
.font(.caption)
|
||||
.font(.system(size: Design.BaseFontSize.caption))
|
||||
.foregroundStyle(.secondary)
|
||||
|
||||
// Segmented buttons
|
||||
@ -102,7 +102,7 @@ public struct SettingsSegmentedPicker<T: Equatable, Accessory: View>: View {
|
||||
selection = option.1
|
||||
} label: {
|
||||
Text(option.0)
|
||||
.font(.subheadline.weight(.medium))
|
||||
.font(.system(size: Design.BaseFontSize.body, weight: .medium))
|
||||
.foregroundStyle(selection == option.1 ? Color.white : .primary)
|
||||
.padding(.vertical, Design.Spacing.small)
|
||||
.frame(maxWidth: .infinity)
|
||||
|
||||
@ -111,25 +111,24 @@ public struct SettingsSlider<Value: BinaryFloatingPoint & Sendable>: View where
|
||||
VStack(alignment: .leading, spacing: Design.Spacing.small) {
|
||||
HStack {
|
||||
Text(title)
|
||||
.font(.subheadline.weight(.medium))
|
||||
.font(.system(size: Design.BaseFontSize.medium, weight: .medium))
|
||||
.foregroundStyle(.primary)
|
||||
|
||||
Spacer()
|
||||
|
||||
Text(format(value))
|
||||
.font(.subheadline.weight(.medium))
|
||||
.fontDesign(.rounded)
|
||||
.font(.system(size: Design.BaseFontSize.body, weight: .medium, design: .rounded))
|
||||
.foregroundStyle(.secondary)
|
||||
}
|
||||
|
||||
Text(subtitle)
|
||||
.font(.caption)
|
||||
.font(.system(size: Design.BaseFontSize.caption))
|
||||
.foregroundStyle(.secondary)
|
||||
|
||||
HStack(spacing: Design.Spacing.medium) {
|
||||
if let leadingIcon {
|
||||
leadingIcon
|
||||
.font(.caption2)
|
||||
.font(.system(size: Design.BaseFontSize.small))
|
||||
.foregroundStyle(.secondary)
|
||||
}
|
||||
|
||||
@ -138,7 +137,7 @@ public struct SettingsSlider<Value: BinaryFloatingPoint & Sendable>: View where
|
||||
|
||||
if let trailingIcon {
|
||||
trailingIcon
|
||||
.font(.callout)
|
||||
.font(.system(size: Design.BaseFontSize.large))
|
||||
.foregroundStyle(.secondary)
|
||||
}
|
||||
}
|
||||
|
||||
@ -79,17 +79,17 @@ public struct SettingsToggle<Accessory: View>: View {
|
||||
VStack(alignment: .leading, spacing: Design.Spacing.xxSmall) {
|
||||
HStack(spacing: Design.Spacing.xSmall) {
|
||||
Text(title)
|
||||
.font(.subheadline.weight(.medium))
|
||||
.font(.system(size: Design.BaseFontSize.medium, weight: .medium))
|
||||
.foregroundStyle(.primary)
|
||||
|
||||
if let titleAccessory {
|
||||
titleAccessory
|
||||
.font(.caption2)
|
||||
.font(.system(size: Design.BaseFontSize.small))
|
||||
}
|
||||
}
|
||||
|
||||
Text(subtitle)
|
||||
.font(.subheadline)
|
||||
.font(.system(size: Design.BaseFontSize.body))
|
||||
.foregroundStyle(.secondary)
|
||||
}
|
||||
}
|
||||
|
||||
@ -116,11 +116,11 @@ public struct iCloudSyncSettingsView<ViewModel: CloudSyncable>: View {
|
||||
if viewModel.iCloudEnabled && viewModel.iCloudAvailable {
|
||||
HStack(spacing: Design.Spacing.small) {
|
||||
Image(systemName: syncStatusIcon)
|
||||
.font(.subheadline)
|
||||
.font(.system(size: Design.BaseFontSize.body))
|
||||
.foregroundStyle(syncStatusColor)
|
||||
|
||||
Text(syncStatusText)
|
||||
.font(.caption)
|
||||
.font(.system(size: Design.BaseFontSize.caption))
|
||||
.foregroundStyle(.white.opacity(Design.Opacity.medium))
|
||||
|
||||
Spacer()
|
||||
@ -129,7 +129,7 @@ public struct iCloudSyncSettingsView<ViewModel: CloudSyncable>: View {
|
||||
viewModel.forceSync()
|
||||
} label: {
|
||||
Text(String(localized: "Sync Now"))
|
||||
.font(.caption.weight(.medium))
|
||||
.font(.system(size: Design.BaseFontSize.caption, weight: .medium))
|
||||
.foregroundStyle(accentColor)
|
||||
}
|
||||
}
|
||||
|
||||
@ -45,10 +45,10 @@ final class BedrockTests: XCTestCase {
|
||||
XCTAssertGreaterThan(Design.Animation.springDuration, 0)
|
||||
}
|
||||
|
||||
func testIconSizesArePositive() {
|
||||
XCTAssertGreaterThan(Design.IconSize.small, 0)
|
||||
XCTAssertGreaterThan(Design.IconSize.medium, 0)
|
||||
XCTAssertGreaterThan(Design.IconSize.large, 0)
|
||||
func testFontSizesArePositive() {
|
||||
XCTAssertGreaterThan(Design.BaseFontSize.small, 0)
|
||||
XCTAssertGreaterThan(Design.BaseFontSize.body, 0)
|
||||
XCTAssertGreaterThan(Design.BaseFontSize.title, 0)
|
||||
}
|
||||
|
||||
func testMinimumTouchTargetMeetsHIG() {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user