perf: cache RelativeDateTimeFormatter; add .DS_Store to .gitignore

Co-authored-by: robonen <26167508+robonen@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-03-13 23:08:08 +00:00
parent d642bffcaa
commit 9259a3693a
3 changed files with 16 additions and 4 deletions
+4
View File
@@ -8,5 +8,9 @@ DerivedData/
*.ipa
*.dSYM.zip
*.dSYM
# Swift Package Manager
.build/
.swiftpm/
# macOS
.DS_Store
@@ -117,8 +117,12 @@ struct NotificationRowView: View {
extension Date {
var relativeFormatted: String {
Date.relativeDateTimeFormatter.localizedString(for: self, relativeTo: Date())
}
private static let relativeDateTimeFormatter: RelativeDateTimeFormatter = {
let formatter = RelativeDateTimeFormatter()
formatter.locale = Locale(identifier: "ru_RU")
return formatter.localizedString(for: self, relativeTo: Date())
}
return formatter
}()
}
@@ -124,8 +124,12 @@ struct MaydayLiveActivityLiveActivity: Widget {
extension Date {
var relativeFormatted: String {
Date.relativeDateTimeFormatter.localizedString(for: self, relativeTo: Date())
}
private static let relativeDateTimeFormatter: RelativeDateTimeFormatter = {
let formatter = RelativeDateTimeFormatter()
formatter.locale = Locale(identifier: "ru_RU")
return formatter.localizedString(for: self, relativeTo: Date())
}
return formatter
}()
}