Reputation: 1748
I'm making a game using swift, and I need to make use of Delta Time, but it's a CFTimeInterval (Double), and ideally I need it to be a float value so I can use it in my other code.
I'm guessing it's easy, I just can't get it!
Upvotes: 0
Views: 4919
Reputation: 15566
Not sure exactly what you mean. Do you want to pass CFTimeInterval
a float or make it into a float? Either way it should be one of these:
let someFloat: Float = 2.0;
// passing it a float
let someInterval = CFTimeInterval(someFloat)
// creating a float with it
let someOtherFloat = Float(someInterval)
Upvotes: 2
Reputation: 660
Just convert it to Float() I think:
var newValue = Float(CFAbsoluteTimeGetCurrent())
println("Float value: \(newValue)")
Upvotes: 1