Skip to content
Up-Next Queue preview
Rendered from the SwiftUI source on this page.

Up-Next Queue

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

A play queue with the current track highlighted.

Cards · SwiftUI · iOS 17

  • cards
  • swiftui

The actual source

QueueList.swift
// Up-Next Queue · syxUI · https://syxui.dev/components/media2-queue
// Free in any project. Keep this line and credit syxUI where a person can read it.

import SwiftUI

let medGreen = Color(red: 0.16, green: 0.66, blue: 0.40)

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)
    }
}

// Up-next queue
struct QueueList: View {
    let songs = [("Blinding Lights", "The Weeknd", true), ("Levitating", "Dua Lipa", false), ("Watermelon Sugar", "Harry Styles", false)]
    var body: some View {
        VStack(alignment: .leading, spacing: 0) {
            Text("Up Next").font(.system(size: 15, weight: .semibold)).padding(.bottom, 10)
            ForEach(Array(songs.enumerated()), id: \.offset) { i, s in
                HStack(spacing: 12) {
                    if s.2 { Image(systemName: "waveform").font(.system(size: 16)).foregroundStyle(medGreen).frame(width: 22) } else { Image(systemName: "line.3.horizontal").font(.system(size: 14)).foregroundStyle(.secondary).frame(width: 22) }
                    VStack(alignment: .leading, spacing: 2) { Text(s.0).font(.system(size: 14, weight: s.2 ? .semibold : .regular)).foregroundStyle(s.2 ? medGreen : Color.primary); Text(s.1).font(.system(size: 12)).foregroundStyle(.secondary) }
                    Spacer()
                    Text("3:20").font(.system(size: 12)).foregroundStyle(.secondary)
                }.padding(.vertical, 9)
            }
        }.formaCard(16).frame(width: 320)
    }
}
iOS 17 · No dependencies

Dependencies

SwiftUI
No external dependencies

Requires iOS 17