mirror of
https://github.com/XcodesOrg/XcodesApp.git
synced 2026-03-25 08:55:46 +00:00
Show last updated date in toolbar
This commit is contained in:
parent
33b5f96ed2
commit
115de2d3a2
1 changed files with 10 additions and 1 deletions
|
|
@ -7,6 +7,7 @@ struct XcodeListView: View {
|
|||
@State private var selection = Set<String>()
|
||||
@State private var rowBeingConfirmedForUninstallation: AppState.XcodeVersion?
|
||||
@State private var searchText: String = ""
|
||||
@AppStorage("lastUpdated") private var lastUpdated: Double?
|
||||
|
||||
@AppStorage("xcodeListCategory") private var category: Category = .all
|
||||
|
||||
|
|
@ -104,7 +105,7 @@ struct XcodeListView: View {
|
|||
.frame(width: 200)
|
||||
}
|
||||
}
|
||||
.navigationSubtitle(Text("Updated \(Date().addingTimeInterval(-600), style: .relative) ago"))
|
||||
.navigationSubtitle(subtitleText)
|
||||
.frame(minWidth: 200, maxWidth: .infinity, minHeight: 300, maxHeight: .infinity)
|
||||
.alert(item: $appState.error) { error in
|
||||
Alert(title: Text(error.title),
|
||||
|
|
@ -137,6 +138,14 @@ struct XcodeListView: View {
|
|||
SignInPhoneListView(isPresented: $appState.secondFactorData.isNotNil, authOptions: secondFactorData.authOptions, sessionData: secondFactorData.sessionData)
|
||||
}
|
||||
}
|
||||
|
||||
private var subtitleText: Text {
|
||||
if let lastUpdated = lastUpdated.map(Date.init(timeIntervalSince1970:)) {
|
||||
return Text("Updated at \(lastUpdated, style: .date) \(lastUpdated, style: .time)")
|
||||
} else {
|
||||
return Text("")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct XcodeListView_Previews: PreviewProvider {
|
||||
|
|
|
|||
Loading…
Reference in a new issue