29 lines
780 B
Swift
29 lines
780 B
Swift
|
import SwiftUI
|
||
|
|
||
|
struct HistoryList: View {
|
||
|
|
||
|
@EnvironmentObject
|
||
|
var storage: TemperatureStorage
|
||
|
|
||
|
var body: some View {
|
||
|
NavigationView {
|
||
|
List(storage.dailyMeasurementCounts) { day in
|
||
|
NavigationLink(destination: {
|
||
|
TemperatureDayOverview(storage: storage, dateIndex: day.dateIndex)
|
||
|
}) {
|
||
|
HistoryListRow(entry: day)
|
||
|
}
|
||
|
}
|
||
|
.navigationTitle("History")
|
||
|
.navigationBarTitleDisplayMode(.large)
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
struct HistoryList_Previews: PreviewProvider {
|
||
|
static var previews: some View {
|
||
|
HistoryList()
|
||
|
.environmentObject(TemperatureStorage(lastMeasurements: TemperatureMeasurement.mockData))
|
||
|
}
|
||
|
}
|