Skip to content

Instantly share code, notes, and snippets.

@HassanElDesouky
Created January 18, 2019 15:10
Show Gist options
  • Save HassanElDesouky/80646bf1b2dd19d76456dc66286ef95e to your computer and use it in GitHub Desktop.
Save HassanElDesouky/80646bf1b2dd19d76456dc66286ef95e to your computer and use it in GitHub Desktop.
04_medium_article_AppleVoiceMemosClone
@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