Convert radians to degrees

 Problem

I want to convert radians to degrees.



 Recipe



// Declare radiansToDegrees function
func radiansToDegrees (radians: Double)->Double {
    return radians * 180 / M_PI
}

// Get degrees for radians
var degrees = radiansToDegrees(1)
print(degrees)
				

Heard the news?

The Swift Cookbook for Swift 3 is at last here! For iBooks, Kindle and Paperback.
Hurry up - and Check it out! ;-)

 

 Playground