SPB Git

Repository Public

SystemControls.swift 1.1 KB 32 lines swift

1// SP Music iOS2// File: Components/SystemControls.swift3// Description: System output picker (AirPlay, Bluetooth) and system volume slider.4//5// Author: Simon-Pierre Boucher6// Contact: contact@spboucher.ai78import AVKit9import MediaPlayer10import SwiftUI1112/// The system's output picker (AirPods, Bluetooth, AirPlay speakers, car).13struct RoutePickerButton: UIViewRepresentable {14    var tint: UIColor = .white15    func makeUIView(context: Context) -> AVRoutePickerView {16        let v = AVRoutePickerView()17        v.tintColor = tint; v.activeTintColor = UIColor(Color.spEmber); v.prioritizesVideoDevices = false18        return v19    }20    func updateUIView(_ v: AVRoutePickerView, context: Context) { v.tintColor = tint }21}2223/// The system volume (the one the side buttons and AirPods change). An app cannot have a volume of its own on iOS.24struct SystemVolumeSlider: UIViewRepresentable {25    func makeUIView(context: Context) -> MPVolumeView {26        let v = MPVolumeView(frame: .zero)27        v.tintColor = .white28        return v29    }30    func updateUIView(_ v: MPVolumeView, context: Context) {}31}32
Files main
Menu

Theme