title: Change play button to pause on click
body: <p>i am building app with Xcode 11 Swift and i want to add mp3 file in my app and so far i have done this </p>
  
  <p><a href="https://i.stack.imgur.com/xkBHZ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/xkBHZ.png" alt="enter image description here"></a></p>
  
  <p>but i want to show just one button like when user click on play button pause button should display and vice versa, how can i get this ? this is my code to play mp3 file</p>
  
  <pre><code> @IBAction func Play(_sender: Any) {
             player.play()
   }
  
   @IBAction func Stop(_sender: Any) {
             player.stop()
   }
  
  let audioPlayer = Bundle.main.path(forResource: "chalisa", ofType: "mp3")
  try player = AVAudioPlayer(contentsOf: NSURL(fileURLWithPath: audioPlayer!)) as URL
  </code></pre>