Skip to content

Instantly share code, notes, and snippets.

@HassanElDesouky
Created January 18, 2019 15:06
Show Gist options
  • Save HassanElDesouky/3aded6f035a2de79a8fda8f9f360d53b to your computer and use it in GitHub Desktop.
Save HassanElDesouky/3aded6f035a2de79a8fda8f9f360d53b to your computer and use it in GitHub Desktop.
02_medium_article_AppleVoiceMemosClone
import UIKit
public extension UIColor {
public convenience init(r: CGFloat, g: CGFloat, b: CGFloat) {
self.init(red: r/255, green: g/255, blue: b/255, alpha: 1)
}
}
extension Int {
var degreesToRadians: CGFloat {
return CGFloat(self) * .pi / 180.0
}
}
extension Double {
var toTimeString: String {
let seconds: Int = Int(self.truncatingRemainder(dividingBy: 60.0))
let minutes: Int = Int(self / 60.0)
return String(format: "%d:%02d", minutes, seconds)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment