f5dd7fa724
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
27 lines
640 B
Swift
27 lines
640 B
Swift
import SwiftUI
|
|
|
|
struct ContentView: View {
|
|
@State private var store = WordStore()
|
|
@State private var speech = SpeechService()
|
|
|
|
var body: some View {
|
|
Group {
|
|
if let error = store.loadError {
|
|
ContentUnavailableView(
|
|
"词库加载失败",
|
|
systemImage: "exclamationmark.triangle",
|
|
description: Text(error)
|
|
)
|
|
} else {
|
|
CategoryListView(categories: store.categories)
|
|
}
|
|
}
|
|
.environment(speech)
|
|
.onAppear { store.load() }
|
|
}
|
|
}
|
|
|
|
#Preview {
|
|
ContentView()
|
|
}
|