In this section, we will talk about audio capabilities in iOS. Now, we have a lot of remarkable APIs to provide the best experience when dealing with audio files. You can play back audio files, record audio, or even recognize speech. In this section, we will see how to play back audio files, record voices, and use the new Speech framework in iOS 10 to recognize speech in many different languages. We will build a demo to see how to work with all of these awesome features.
The only thing that you should be ready with is an audio file to play. In our demo, we are using a sample audio file to play in the app.
Create a new Xcode project with the Single View Application template and the name
PlayingWithAudio
.Add a
UIButton
method at the top of screen with the titlePlay Audio
.Link the action of this button to the
ViewController.swift
file, like this:@IBAction func didClickOnPlayAudio(_ sender: AnyObject) { ...