Last active
September 27, 2017 20:37
-
-
Save kechan/28f5ca091b8decf0b9ab2b71f0af4eee to your computer and use it in GitHub Desktop.
Some units conversion
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension Double { | |
var km: Double { return self } // This is stored as km, everything else will need conversion instead. | |
var mile: Double { return 0.6214 * self } | |
} | |
10.km | |
10.mile | |
let x = 10.0 // if user unit is miles | |
let dist = x/1.mile | |
dist |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment