1.
import MediaPlayer
2.
let volumeView = MPVolumeView(frame: CGRect.zero)
3.
override func viewDidLoad() {
super.viewDidLoad()
volumeView.tag=1
self.view.addSubview(volumeView)
}
4.
@IBAction func didTapCloseButton(_ sender: Any) {
if let view = self.view.viewWithTag(1) {
view.removeFromSuperview()
}
self.dismiss(animated: true, completion: nil)
}