I have a label showing a number and I want to change it to a higher number, however, I'd like to add a bit of flare to it. I'd like to have the number increment up to the higher number with an ease-in-out curve so it speeds up then slows down. Please, how to implement this in swift, Here is my code. Thanks.
let newValue : Double = 1000
let oldValue : Double = 500
timer = NSTimer.scheduledTimerWithTimeInterval(0.1, target: self, selector: Selector("countAnimation:"), userInfo: ["oldValue":oldValue, "newValue": newValue], repeats: true)
func countAnimation(timer: NSTimer)
{
let dict = timer.userInfo as? [String:AnyObject]
var OldTotalValue : Double = (dict!["oldValue"] as? Double)!
let newTotalValue : Double = (dict!["newValue"] as? Double)!
OldTotalValue = OldTotalValue + 10
if newTotalValue < OldTotalValue
{
timer.invalidate()
}
else
{
mylabel.text = String(OldTotalValue)
}
}