I've tried to apply the Singleton approach found here. This creates a singleton that could be loaded up with different the different formats you use within your application. For example, you could access it anywhere in your application with formatter.fromDateTime(myString)
let formatter = FormatterFormats()
class FormatterFormats {
var dateTime: NSDateFormatter = NSDateFormatter()
class var sharedInstance:FormatterFormats {
return formatter
}
func fromDateTime(dateString: String) -> NSDate {
return dateTime.dateFromString(dateString)!
}
init() {
dateTime.dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSZ"
}
}