
Media Sliders
From syxUI — written for both platforms, not translated between them.
Volume and brightness control sliders.
Cards · SwiftUI · iOS 17
- cards
- swiftui
The actual source
VolumeControls.swift
// Media Sliders · syxUI · https://syxui.dev/components/media2-volume
// Free in any project. Keep this line and credit syxUI where a person can read it.
import SwiftUI
extension View {
func formaCard(_ pad: CGFloat = 18) -> some View {
self.padding(pad)
.background(Color(.systemBackground), in: RoundedRectangle(cornerRadius: 20, style: .continuous))
.overlay(RoundedRectangle(cornerRadius: 20, style: .continuous).stroke(Color.primary.opacity(0.06), lineWidth: 1))
.shadow(color: .black.opacity(0.05), radius: 14, x: 0, y: 6)
}
}
// Volume / brightness sliders
struct VolumeControls: View {
var body: some View {
VStack(spacing: 14) {
slider("speaker.wave.2.fill", 0.6)
slider("sun.max.fill", 0.4)
}.formaCard().frame(width: 300)
}
func slider(_ icon: String, _ value: CGFloat) -> some View {
GeometryReader { g in
ZStack(alignment: .leading) {
RoundedRectangle(cornerRadius: 14, style: .continuous).fill(Color.primary.opacity(0.08))
RoundedRectangle(cornerRadius: 14, style: .continuous).fill(Color.primary).frame(width: g.size.width * value)
Image(systemName: icon).font(.system(size: 16)).foregroundStyle(value > 0.15 ? Color(.systemBackground) : Color.secondary).padding(.leading, 16).frame(maxHeight: .infinity)
}
}.frame(height: 48)
}
}
iOS 17 · No dependencies
Dependencies
- SwiftUI
- No external dependencies
Requires iOS 17


