TestsTested | ✗ |
LangLanguage | SwiftSwift |
License | MIT |
ReleasedLast Release | Dec 2017 |
SwiftSwift Version | 4.0 |
SPMSupports SPM | ✗ |
Maintained by PJ Vea.
VSCachedThreadLocalHelper is a helper class that creates cached thread local objects. It is most commonly used for DateFormatters. That way your DateFormatters don't have to be reallocated every time you want to use them.
To run the example project, clone the repo, and run pod install
from the Example directory first.
VSCachedThreadLocalHelper is available through CocoaPods. To install
it, simply add the following line to your Podfile:
pod 'VSCachedThreadLocalHelper'
This is most comonnly used to create DateFormatters.
func getHoursMinutesPeriodDateFormatter() -> DateFormatter {
return VSCachedThreadLocalHelper.cachedThreadLocalObjectWithKey(key: "HoursMinutesPeriodDateFormatter") {
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "h:mm a"
return dateFormatter
}
}
PJ Vea, @pjvea
Vea Software LLC
VSCachedThreadLocalHelper is available under the MIT license. See the LICENSE file for more info.