Skip to content
Podcast Controls preview
Rendered from the SwiftUI source on this page.

Podcast Controls

From syxUI — written for both platforms, not translated between them.

Podcast playback with skip-15 / skip-30 and speed.

Cards · SwiftUI · iOS 17

  • cards
  • swiftui

The actual source

PodcastControls.swift
// Podcast Controls · syxUI · https://syxui.dev/components/media2-podcast-controls
// 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)
    }
}

// Podcast player controls
struct PodcastControls: View {
    var body: some View {
        VStack(spacing: 14) {
            GeometryReader { g in ZStack(alignment: .leading) { Capsule().fill(Color.primary.opacity(0.1)).frame(height: 4); Capsule().fill(Color.primary).frame(width: g.size.width * 0.2, height: 4) } }.frame(height: 4)
            HStack { Text("00:05").font(.system(size: 11)).foregroundStyle(.secondary); Spacer(); Text("-04:35").font(.system(size: 11)).foregroundStyle(.secondary) }
            HStack(spacing: 24) {
                Text("1×").font(.system(size: 15, weight: .semibold)).foregroundStyle(.secondary)
                Image(systemName: "gobackward.15").font(.system(size: 24)).foregroundStyle(.primary)
                Image(systemName: "pause.fill").font(.system(size: 26)).foregroundStyle(.white).frame(width: 62, height: 62).background(Color.primary, in: Circle())
                Image(systemName: "goforward.30").font(.system(size: 24)).foregroundStyle(.primary)
                Image(systemName: "moon.fill").font(.system(size: 16)).foregroundStyle(.secondary)
            }
        }.formaCard().frame(width: 320)
    }
}
iOS 17 · No dependencies

Dependencies

SwiftUI
No external dependencies

Requires iOS 17