How to Play Sound Files with AVFoundation - Part 9

Опубликовано: 24 Июль 2026
на канале: Credo Creator Studio
3,458
45

Credo Academy ♥️ https://credo.academy I think you will enjoy this SwiftUI class because sounds can make apps to life and increase overall user engagement at the same time. It’s always fun playing sounds and music in iOS development, and the same is true for SwiftUI.

CHAPTERS

00:00 Introduction
00:45 Add the sound file to the iOS app project
01:21 Create a new Swift file
01:39 Import the 'AVFoundation' iOS framework
01:58 Create an audio player variable
02:10 Create a new reusable Swift function
02:19 Add a file name and a file format parameter for the function
02:38 Use the 'Do-Try-Catch' error handling in Swift
03:10 Create an audio player
03:25 Play the music file in the function
03:45 Implement the function in the project
04:03 Call the 'Play Sound' function inside the button
04:23 Start the Live Preview in the Xcode's Canvas
04:33 Test the SwiftUI application
04:45 Build and run the iOS project in the Xcode's Simulator
05:00 Test the user experience in the Simulator

#SwiftUI #Xcode #Programming