Created
December 31, 2019 21:54
-
-
Save marcushvega/ba31556c67cb4f6a084e8a16e549b10f to your computer and use it in GitHub Desktop.
Use of system symbol image
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @IBAction func playOrPause(_ sender: Any) { | |
| let playPauseImageConfig = UIImage.SymbolConfiguration(pointSize: self.view.frame.height * relativePointSizeConstant, weight: .regular, scale: .large) | |
| let pauseImage = UIImage(systemName: "pause.fill", withConfiguration: playPauseImageConfig) | |
| let playImage = UIImage(systemName: "play.fill", withConfiguration: playPauseImageConfig) | |
| // if timer is not running then start timer | |
| if (timerIsPaused) { | |
| playPauseBtn.setImage(pauseImage, for: .normal) | |
| timer = Timer.scheduledTimer(timeInterval: 1.0, target: self, selector: #selector(startTimer), userInfo: nil, repeats: true) | |
| timerIsPaused = false | |
| } | |
| // if timer is running then pause timer | |
| else { | |
| playPauseBtn.setImage(playImage, for: .normal) | |
| timer?.invalidate() | |
| timerIsPaused = true | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment