Created
January 18, 2019 15:06
-
-
Save HassanElDesouky/3aded6f035a2de79a8fda8f9f360d53b to your computer and use it in GitHub Desktop.
02_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
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