Recording audio using AVAudioRecorder Swift 2.1

Hello today we will learn Recording audio using AVAudioRecorder Swift 2.1. Its not a hard task as simple as pie.

First of all Add AVFoundation.framework to your project. Project settings > Build Phrases > Link Binary with libraries > click on “+” button search for AVFoundation.framework and Add.

Recording audio using AVAudioRecorder Swift 2.1
Recording audio using AVAudioRecorder Swift 2.1

Now go to ViewController.swift file. Import AVAudioRecorderDelegate, make object of AVAudioRecorder.

Lets create a method to record audio.

If you stop a recording then the delegate method will call called. We can stop a recording using below command.

 

The delegate method is below.

You can also use recorder.url.lastPathComponent gives us the name of the recorded file.

We can also add some settings to our audio file.

So simple right. never thought Recording audio using AVAudioRecorder Swift 2.1 was that simple.

Today we learn Recording audio using AVAudioRecorder Swift 2.1. Happy coding 😉

 

Add a Comment

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.