Is there a method to close files in Swift? Specifically AVAudioFile files?

I have no problem creating, and writing to AVAudioFiles.

do {
   audioFile = try AVAudioFile(forWriting: destinationPath, settings: format.settings)
   print ("created: \(curFileLinkName)")
} catch { print ("error creating file")}

But is there a way to close the file?

I've searched and all I could find was this very post on StackOverflow, which makes me wonder.

Accepted Reply

Hello,

There is not, the file closes once the AVAudioFile is deinitialized. I recommend that you file an enhancement request for this functionality using Feedback Assistant, and provide a short description about how this functionality would benefit your app.

Replies

Hello,

There is not, the file closes once the AVAudioFile is deinitialized. I recommend that you file an enhancement request for this functionality using Feedback Assistant, and provide a short description about how this functionality would benefit your app.

There is not, the file closes once the AVAudioFile is deinitialized

if I use the same handle to create a second file, would that close the first?