Last active
June 6, 2019 05:02
-
-
Save Mreyna3/df7207b3c867b1199882c1588a53d0bd to your computer and use it in GitHub Desktop.
format extension
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
public extension Double { | |
func format() -> String{ | |
let formatter = NumberFormatter() | |
formatter.numberStyle = .currency | |
let formattedDouble = formatter.string(from: self as NSNumber) | |
return formattedDouble! | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment