Swift utility functions
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
// Degrees to Radians | |
func degreesToRadians(_ number: Double) -> Double { | |
return number * .pi / 180 | |
} | |
// Radians to Degrees | |
func radiansToDegrees(_ number: Double) -> Double { | |
return number / Double.pi * 180 | |
} | |
// Delay function with closure | |
func delay(seconds: Double, completion: @escaping ()-> Void) { | |
DispatchQueue.main.asyncAfter(deadline: .now() + seconds, execute: completion) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment