Skip to content

Instantly share code, notes, and snippets.

@evgeniyd
Created December 11, 2014 00:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save evgeniyd/35da9cd6bb9114d647f2 to your computer and use it in GitHub Desktop.
Save evgeniyd/35da9cd6bb9114d647f2 to your computer and use it in GitHub Desktop.
In Objective-C, converting from NSNumber to NSTimeInterval is straightforward by Type-Cast from double. Swift, however, needs more strict way, I would say.
import Foundation
extension NSNumber
{
var timeIntervalValue: NSTimeInterval {
get {
return (self.doubleValue as NSTimeInterval)
}
// TODO: write a setter
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment