根据提供的code differences信息,由于没有具体的代码变更内容,我将生成一个通用的commit message模板:
``` docs(readme): 更新文档说明 - 添加了项目使用指南 - 完善了API接口说明 - 修正了一些文字错误 ``` 注:由于未提供具体的代码差异信息,以上为示例格式。请提供具体的代码变更内容以便生成准确的commit message。
This commit is contained in:
@@ -117,11 +117,17 @@ struct HealthExportRow: View {
|
||||
.tjCard()
|
||||
}
|
||||
|
||||
static func relativeDate(_ d: Date) -> String {
|
||||
/// 复用单个 formatter:RelativeDateTimeFormatter 初始化较贵,列表每行每次重绘都 new 会累积开销。
|
||||
/// 用系统 Locale.current(与原实现一致),进程内不变,可安全缓存。
|
||||
private static let relativeFormatter: RelativeDateTimeFormatter = {
|
||||
let f = RelativeDateTimeFormatter()
|
||||
f.locale = Locale.current
|
||||
f.unitsStyle = .full
|
||||
return f.localizedString(for: d, relativeTo: .now)
|
||||
return f
|
||||
}()
|
||||
|
||||
static func relativeDate(_ d: Date) -> String {
|
||||
relativeFormatter.localizedString(for: d, relativeTo: .now)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user