Implement WordListView

This commit is contained in:
2024-02-25 18:46:26 +01:00
parent 286714b69a
commit b38827070d
2 changed files with 19 additions and 1 deletions

View File

@@ -14,6 +14,10 @@ class WordAXModelView: ObservableObject {
model = WordAX() model = WordAX()
} }
public var words: [Word] {
model.words
}
public func getDateFormatter() -> DateFormatter { public func getDateFormatter() -> DateFormatter {
model.settings.dateFormatter model.settings.dateFormatter
} }

View File

@@ -8,11 +8,25 @@
import SwiftUI import SwiftUI
struct WordListView: View { struct WordListView: View {
@EnvironmentObject var model: WordAXModelView
@State var showDescription = true
var body: some View { var body: some View {
Text("This is going to be a list of words") NavigationSplitView {
List(model.words) { word in
NavigationLink {
WordView(word: word, showDescription: $showDescription)
} label: {
WordListRowView(word: word)
}
}
.navigationTitle("Word List")
} detail: {
Text("Select word to get details about")
}
} }
} }
#Preview { #Preview {
WordListView() WordListView()
.environmentObject(WordAXModelView())
} }