// AUV3 Diagnostic — paste into Swift Playgrounds on iPad // Results display on screen (scroll to see all). import SwiftUI import AVFoundation import AudioToolbox struct AUEntry: Identifiable { let id = UUID() let name: String let manufacturer: String let typeLabel: String } struct ContentView: View { @State private var appleEntries: [AUEntry] = [] @State private var thirdPartyEntries: [AUEntry] = [] @State private var totalCount = 0 var body: some View { NavigationView { List { Section("Summary") { Text("Total components: \(totalCount)") Text("Apple: \(appleEntries.count)") Text("Third-party: \(thirdPartyEntries.count)") if thirdPartyEntries.isEmpty { Text("No third-party AUV3 found. Add inter-app-audio entitlement to your app.") .foregroundColor(.red) .font(.caption) } } Section("Apple (\(appleEntries.count))") { ForEach(appleEntries) { e in VStack(alignment: .leading, spacing: 2) { Text(e.name).font(.body) Text("[\(e.typeLabel)] \(e.manufacturer)") .font(.caption).foregroundColor(.secondary) } } } Section("Third-Party (\(thirdPartyEntries.count))") { ForEach(thirdPartyEntries) { e in VStack(alignment: .leading, spacing: 2) { Text(e.name).font(.body) Text("[\(e.typeLabel)] \(e.manufacturer)") .font(.caption).foregroundColor(.secondary) } } } } .navigationTitle("AUV3 Diagnostic") .onAppear { scan() } } } func scan() { let mgr = AVAudioUnitComponentManager.shared() var wildcard = AudioComponentDescription() wildcard.componentType = 0 wildcard.componentSubType = 0 wildcard.componentManufacturer = 0 wildcard.componentFlags = 0 wildcard.componentFlagsMask = 0 let all = mgr.components(matching: wildcard) totalCount = all.count let appleMfr: UInt32 = 0x6170706C var seen = Set() var apple: [AUEntry] = [] var external: [AUEntry] = [] for comp in all { let d = comp.audioComponentDescription let key = "\(d.componentType)_\(d.componentSubType)_\(d.componentManufacturer)" guard !seen.contains(key) else { continue } seen.insert(key) let typeStr: String switch d.componentType { case kAudioUnitType_Effect: typeStr = "Effect" case kAudioUnitType_MusicEffect: typeStr = "MusicEffect" case kAudioUnitType_MusicDevice: typeStr = "MusicDevice" case kAudioUnitType_Generator: typeStr = "Generator" case kAudioUnitType_Mixer: typeStr = "Mixer" case kAudioUnitType_Output: typeStr = "Output" case kAudioUnitType_Panner: typeStr = "Panner" case kAudioUnitType_FormatConverter: typeStr = "FormatConverter" default: typeStr = "Other(\(d.componentType))" } let entry = AUEntry(name: comp.name, manufacturer: comp.manufacturerName, typeLabel: typeStr) if d.componentManufacturer == appleMfr { apple.append(entry) } else { external.append(entry) } } appleEntries = apple.sorted { $0.name < $1.name } thirdPartyEntries = external.sorted { $0.name < $1.name } } }