Home>
  

There are two, SecondViewController and FirstswitchViewController,
  When you tap the label in SeconViewController, it jumps to FirstSwitchViewController where you can set the volume of mp3 with slider. However, as soon as you mess with the slider, you will (forcedly) return to SecondViewController. There are no errors in the code. I am glad if you can tell me because I don't understand it by myself.

import UIKit
import AVFoundation
class FirstSwitchViewController: UIViewController {
    var audioPlayer: AVAudioPlayer!
    var volumeSlider = UISlider ()
    @IBOutlet weak var label: UILabel!
    @IBAction func back (_ sender: UIBarButtonItem)
    {
        self.dismiss (animated: true, completion: nil)
    }
    @IBAction func volumeChange (_ sender: UISlider)
    {
        let value = round (sender.value * 100)/1
        volumeSlider.value = sender.value
        label.text = "\ (value)"
        audioPlayer.volume = volumeSlider.value
        audioPlayer.play ()
    }