Implement WordListView
This commit is contained in:
@@ -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
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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())
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user