Skip to content

Instantly share code, notes, and snippets.

@owensd
Last active August 29, 2015 14:02
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save owensd/8337c84a1a7c6635f992 to your computer and use it in GitHub Desktop.
Save owensd/8337c84a1a7c6635f992 to your computer and use it in GitHub Desktop.
class MyDoubleDouble : FloatLiteralConvertible {
var double : Double
init(_ value: Double) {
double = value * 2
}
class func convertFromFloatLiteral(value: Double) -> MyDoubleDouble {
return MyDoubleDouble(value)
}
}
let double = 2.0 // double has a value of 2.0
let myDouble : MyDoubleDouble = 2.0 // myDouble.double has a value of 4.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment