Improve log date

This commit is contained in:
Garth Vander Houwen 2024-06-05 10:23:15 -07:00
parent 290a19a022
commit 345d6c4d39

View file

@ -15,13 +15,21 @@ struct AppLog: View {
@State private var sortOrder = [KeyPathComparator(\OSLogEntryLog.date)]
@State private var selection = Set<OSLogEntryLog.ID>()
private var idiom: UIUserInterfaceIdiom { UIDevice.current.userInterfaceIdiom }
let dateFormatStyle = Date.FormatStyle()
.year(.twoDigits)
.month(.defaultDigits)
.day(.defaultDigits)
.hour(.twoDigits(amPM: .omitted))
.minute()
.second()
.secondFraction(.fractional(3))
var body: some View {
Table(logs, selection: $selection, sortOrder: $sortOrder) {
if idiom != .phone {
TableColumn("Date", value: \.date) { value in
Text("\(value.date, format: .dateTime)")
Text(value.date.formatted(dateFormatStyle))
}
.width(min: 150, max: 200)
TableColumn("Category", value: \.category)
@ -36,7 +44,6 @@ struct AppLog: View {
.task {
logs = await fetchLogs()
}
.presentationCompactAdaptation(.fullScreenCover)
.navigationTitle("Debug Logs")
}
}