Answers for "swift exception handling"

0

swift try catch

do {
    // Create audio player object
    audioPlayer = try AVAudioPlayer(contentsOf: soundURL)
            
    // Play the sound
    audioPlayer?.play()
}
catch {
    // Couldn't create audio player object, log the error
    print("Couldn't create the audio player for file \(soundFilename)")
}
Posted by: Guest on June-11-2021

Code answers related to "Swift"

Browse Popular Code Answers by Language