测试已测试 | ✗ |
语言语言 | SwiftSwift |
许可证 | MIT |
发布上次发布 | 2017年12月 |
SwiftSwift 版本 | 4.0 |
SPM支持 SPM | ✗ |
由 PJ Vea 维护。
VSCachedThreadLocalHelper 是一个创建缓存线程本地对象的辅助类。它通常用于 DateFormatters。这样可以确保在每次使用它们时不需要重新分配 DateFormatters。
要运行示例项目,请克隆仓库,然后首先从 Example 目录中运行 pod install
。
VSCachedThreadLocalHelper 通过 CocoaPods 提供。要安装它,只需将以下行添加到您的 Podfile
。
pod 'VSCachedThreadLocalHelper'
这通常用于创建 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 在 MIT 许可下提供。有关更多信息,请参阅 LICENSE 文件。