From 835e41841b4e4f9e87f8b0aad7a9ec7a446141cd Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Sun, 4 Jan 2026 17:52:08 -0600 Subject: [PATCH] Remove VolumePicker (replaced by SettingsSlider with SliderFormat.percentage) --- README.md | 16 ++-- .../Bedrock/Views/Settings/SETTINGS_GUIDE.md | 15 ---- .../Bedrock/Views/Settings/VolumePicker.swift | 78 ------------------- 3 files changed, 10 insertions(+), 99 deletions(-) delete mode 100644 Sources/Bedrock/Views/Settings/VolumePicker.swift diff --git a/README.md b/README.md index fe39692..0311e32 100644 --- a/README.md +++ b/README.md @@ -222,16 +222,20 @@ SettingsToggle( isOn: $notificationsEnabled ) -// Volume slider -VolumePicker(label: "Volume", volume: $soundVolume) +// Slider with format helpers +SettingsSlider( + title: "Brightness", + subtitle: "Adjusts the brightness", + value: $brightness, + format: SliderFormat.percentage, + leadingIcon: Image(systemName: "sun.min"), + trailingIcon: Image(systemName: "sun.max.fill") +) // Segmented picker SegmentedPicker( title: "Theme", - options: [ - SegmentedOption(label: "Light", value: "light"), - SegmentedOption(label: "Dark", value: "dark") - ], + options: [("Light", "light"), ("Dark", "dark")], selection: $theme ) diff --git a/Sources/Bedrock/Views/Settings/SETTINGS_GUIDE.md b/Sources/Bedrock/Views/Settings/SETTINGS_GUIDE.md index 267efd7..c903be6 100644 --- a/Sources/Bedrock/Views/Settings/SETTINGS_GUIDE.md +++ b/Sources/Bedrock/Views/Settings/SETTINGS_GUIDE.md @@ -538,20 +538,6 @@ SelectableRow( --- -### VolumePicker - -A slider with speaker icons for volume/percentage values. - -```swift -VolumePicker( - label: "Volume", - volume: $viewModel.volume, - accentColor: AppAccent.primary -) -``` - ---- - ### BadgePill A capsule badge for values or tags. @@ -725,7 +711,6 @@ SettingsCard(backgroundColor: AppSurface.card, borderColor: AppBorder.subtle) { | `SegmentedPicker` | Option selection | `title`, `options`, `selection` | | `SettingsRow` | Action rows | `systemImage`, `title`, `action` | | `SelectableRow` | Card selection | `title`, `isSelected`, `badge` | -| `VolumePicker` | Audio volume | `label`, `volume` | | `BadgePill` | Price/tag badges | `text`, `isSelected` | --- diff --git a/Sources/Bedrock/Views/Settings/VolumePicker.swift b/Sources/Bedrock/Views/Settings/VolumePicker.swift deleted file mode 100644 index fcd735f..0000000 --- a/Sources/Bedrock/Views/Settings/VolumePicker.swift +++ /dev/null @@ -1,78 +0,0 @@ -// -// VolumePicker.swift -// Bedrock -// -// A volume slider with speaker icons. -// - -import SwiftUI - -/// A volume slider with speaker icons. -/// -/// Use this for audio volume or similar 0-1 range settings. -public struct VolumePicker: View { - /// The label for the picker. - public let label: String - - /// Binding to the volume level (0.0 to 1.0). - @Binding public var volume: Float - - /// The accent color for the slider. - public let accentColor: Color - - /// Creates a volume picker. - /// - Parameters: - /// - label: The label text (default: "Volume"). - /// - volume: Binding to volume (0.0-1.0). - /// - accentColor: The accent color (default: primary accent). - public init( - label: String = "Volume", - volume: Binding, - accentColor: Color = .Accent.primary - ) { - self.label = label - self._volume = volume - self.accentColor = accentColor - } - - public var body: some View { - VStack(alignment: .leading, spacing: Design.Spacing.small) { - HStack { - Text(label) - .font(.system(size: Design.BaseFontSize.medium, weight: .medium)) - .foregroundStyle(.white) - - Spacer() - - Text("\(Int(volume * 100))%") - .font(.system(size: Design.BaseFontSize.body, weight: .medium, design: .rounded)) - .foregroundStyle(.white.opacity(Design.Opacity.medium)) - } - - HStack(spacing: Design.Spacing.medium) { - Image(systemName: "speaker.fill") - .font(.system(size: Design.BaseFontSize.body)) - .foregroundStyle(.white.opacity(Design.Opacity.medium)) - - Slider(value: $volume, in: 0...1, step: 0.1) - .tint(accentColor) - - Image(systemName: "speaker.wave.3.fill") - .font(.system(size: Design.BaseFontSize.body)) - .foregroundStyle(.white.opacity(Design.Opacity.medium)) - } - } - .padding(.vertical, Design.Spacing.xSmall) - } -} - -// MARK: - Preview - -#Preview { - VStack(spacing: Design.Spacing.medium) { - VolumePicker(volume: .constant(0.8)) - VolumePicker(label: "Music", volume: .constant(0.5)) - } - .padding() - .background(Color.Surface.overlay) -}