-
-
Save rickyngan/d7acf71a8da59a76f7c9e66a5ba52d2e to your computer and use it in GitHub Desktop.
Swift NSDateFormatter singleton
This file contains hidden or 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
| class var userDateFormatter : NSDateFormatter { | |
| struct Static { | |
| static let instance: NSDateFormatter = { | |
| let dateFormatter = NSDateFormatter() | |
| dateFormatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'" | |
| return dateFormatter | |
| }() | |
| } | |
| return Static.instance | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment