Created
January 18, 2019 15:10
-
-
Save HassanElDesouky/80646bf1b2dd19d76456dc66286ef95e to your computer and use it in GitHub Desktop.
04_medium_article_AppleVoiceMemosClone
This file contains 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
@objc func handleRecording(_ sender: RecordButton) { | |
if recordButton.isRecording { | |
audioView.isHidden = false | |
UIView.animate(withDuration: 0.5, delay: 0, usingSpringWithDamping: 1, initialSpringVelocity: 1, options: .curveEaseOut, animations: { | |
self.handleView.alpha = 1 | |
self.timeLabel.alpha = 1 | |
self.audioView.alpha = 1 | |
self.view.frame = CGRect(x: 0, y: self.view.frame.height, width: self.view.bounds.width, height: -300) | |
self.view.layoutIfNeeded() | |
}, completion: nil) | |
self.checkPermissionAndRecord() | |
} else { | |
audioView.isHidden = true | |
UIView.animate(withDuration: 0.5, delay: 0, usingSpringWithDamping: 1, initialSpringVelocity: 1, options: .curveEaseOut, animations: { | |
self.handleView.alpha = 0 | |
self.timeLabel.alpha = 0 | |
self.audioView.alpha = 0 | |
self.view.frame = CGRect(x: 0, y: 0, width: self.view.bounds.width, height: 150) | |
self.view.layoutIfNeeded() | |
}, completion: nil) | |
self.stopRecording() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment