4
votes

I don't see any reference to standard trig functions (Sine, Cosine, Tangent) in the SWIFT language reference. What is the recommended way to add them? Are there libraries that should be loaded?

1

1 Answers

10
votes

You can still use them as global functions as defined in the Darwin module (imported automatically with Foundation)

import Darwin
var num = CDouble(10)
sin(num)