Your input is a date string which corresponds to ISO8601 standard. For such date strings, the Foundation has a ISO8601DateFormatter class which helps you avoid many edge cases which can lead to wrong date parsing and that's why it's suggested by Apple to use for such date strings this dedicated class than using DateFormatter.
Code with ISO8601DateFormatter
let dateFormatterIso = ISO8601DateFormatter()
dateFormatterIso.formatOptions = [.withFullDate, .withFullTime, .withFractionalSeconds]
let inputDate = dateFormatterIso.date(from: input)
Code with DateFormatter
If you can't use ISO8601DateFormatter then
you have to correct the date format which has wrong mask for fractional seconds: .SSS instead .sss
let dateFormatter = DateFormatter()
dateFormatter.calendar = Calendar(identifier: .iso8601)
dateFormatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSZ"
dateFormatter.locale = Locale(identifier: "en_US_POSIX")
Both formatters returns:
▿ Optional<Date>
▿ some : 2015-06-20 00:47:00 +0000
- timeIntervalSinceReferenceDate : 456454020.48399997