perf: cache RelativeDateTimeFormatter; add .DS_Store to .gitignore
Co-authored-by: robonen <26167508+robonen@users.noreply.github.com>
This commit is contained in:
@@ -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
|
||||
}()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user