Closed JetForMe closed 3 years ago
If you're referring to the global variable, public var dateFormatter: DateFormatter = { /* return formatter */ }()
, it already acts like a static. If it was written as a getter, public var dataFormatter: DateFormatter { /* return formatter */ }
, then that wouldn't be good.
Oh, sorry, I thought it was part of extension Date
, didn't realize it was outside the scope of that. Nevermind!
Just perusing the code, in
Foundation.swift
,extension Date
, it seems aDateFormatter
object is created for everyDate
created. Perhaps that should bestatic
? I believe they're thread-safe once converted, if unmodified.