import SwiftUI struct HistoryView: View { let history: HistoryManagerProtocol @State private var items: [HistoryItem] = [] var body: some View { NavigationStack { List(items) { item in NavigationLink { HistoryItemDetail(item: item) } label: { HistoryListRow(item: item) } } .navigationTitle("History") }.onAppear(perform: loadItems) } private func loadItems() { Task { let entries = history.loadEntries() DispatchQueue.main.async { items = entries } } } } struct HistoryView_Previews: PreviewProvider { static var previews: some View { HistoryView(history: HistoryManagerMock()) } }