title: Setting UIbutton image from a function from another class
body: <p>So I have a list of songs, and when I click on the moreButton the SongDetailCell is presented and the <code>setPlayPauseOnAppeaering()</code> function is called on the selected song.</p>
  
  <p>This function will either set a play or pause icon depending on the if statement. For some reason the pause-icon is not being, even though the correct console logs are being printed. For example, when <strong>"playing with spotify sample"</strong>, the button is not being set to pause, even though it definitely should be. Does anyone know what I am doing wrong here.</p>
  
  <pre><code>class SongList: UICollectionViewCell    {
  
      @objc func moreButtonTap(gesture: UITapGestureRecognizer)  {
  
          var indexPath = getIndexPathFromRecognizer(gesture: gesture)
  
          let songDetailView = SongDetailCell()
          let song = self.songsArray[indexPath.item]
          songDetailView.song = song
          songDetailView.setPlayPauseOnAppearing()
      }
  }
  
  class SongDetailCell: UICollectionViewCell {
      var song: Song! 
  
      let playPauseButton: UIButton = {
          let button = UIButton()
          button.setImage(UIImage(named: "play-button-large"), for: .normal)
          button.translatesAutoresizingMaskIntoConstraints = false
          button.tintColor = UIColor.brandBlack()
          button.contentMode = .scaleToFill
          return button
      }()
  
  func setPlayPauseOnAppearing()    {
  
      func setPlayButton()  {
          playPauseButton.setImage(UIImage(named: "play-button-large")?.withRenderingMode(.alwaysTemplate), for: .normal)
      }
      func setPauseButton()    {
          playPauseButton.setImage(UIImage(named: "pause-button-large")?.withRenderingMode(.alwaysTemplate), for: .normal)
      }
  
      if SongPlayer.shared.doesPreviewExist(spotifyPreviewUrl: spotifyURL, iTunesPreviewUrl: itunesURL)   {
          if SongPlayer.shared.player.timeControlStatus == .paused    {
              if SongPlayer.shared.previewUrl == spotifyURL {
                  setPlayButton()
                  print("paused with Spotify sample")
              } else if SongPlayer.shared.previewUrl == itunesURL {
                  setPlayButton()
                  print("paused with iTunes sample")
              }
          }   else if SongPlayer.shared.player.timeControlStatus == .playing {
              if SongPlayer.shared.previewUrl == spotifyURL {
                  setPauseButton()
                  print("playing with Spotify sample")
              } else if SongPlayer.shared.previewUrl == itunesURL {
                  setPauseButton()
                  print("playing with iTunes sample")
              }
          }   else    {
                  print("no audio sample")
          }
      }
  }
  }
  </code></pre>