I’m attempting to create this
struct PlayAudioIntent: AudioPlaybackIntent {
personal let fileName:String = ""
personal let fileExtension:String = ""
init() {
do {
strive AVAudioSession.sharedInstance().setCategory(.playback)
strive AVAudioSession.sharedInstance().setActive(true)
} catch {
print("Didn't arrange audio session class: (error)")
}
}
init(_ fileName:String, _ fileExtension:String) {
self.fileName = fileName
self.fileExtension = fileExtension
}
func carry out() async throws -> some IntentResult {
if PlayerModel.shared.isPlaying {
PlayerModel.shared.pauseAudio()
} else {
PlayerModel.shared.setupAudio(fileName, fileExtension)
}
return .consequence()
}
}
when the code arrives at
PlayerModel.shared.setupAudio(fileName, fileExtension)
fileName
and fileExtension
are empty.
Why is that if the code is executing the init(filename,fileExtension) appropriately in principle saving the variables with the correct values?