How can I use the AVAudioSEssion in a swift package when the package could be used by Macos?

Viewed 42

import Foundation
import AVFoundation

@available(iOS 14, *)
extension AVAudioSession {

    class func set(category: AVAudioSession.Category = .playback) {
        do {
            try AVAudioSession.sharedInstance().setCategory(category)
        } catch {
            print("Audio session failed", error)
        }
    }
}

enter image description here

Even when I use the @available( attribution it doesn't work. How can I use the AVAudioSEssion in a swift package when the package could be used by Macos?

0 Answers
Related