More robust dictionary search feature, styling tweaks for widgets
This commit is contained in:
@@ -10,8 +10,8 @@ import SwiftUI
|
||||
struct DictionaryView: View {
|
||||
@ObservedObject var tokiDictViewModel = TokiDictionaryViewModel()
|
||||
|
||||
@State var tokiInput: String = ""
|
||||
@State var selectedPartOfSpeech: String?
|
||||
@State private var tokiInput: String = ""
|
||||
@State private var selectedPartOfSpeech: String?
|
||||
|
||||
var body: some View {
|
||||
VStack {
|
||||
@@ -30,7 +30,7 @@ struct DictionaryView: View {
|
||||
PartsOfSpeechView(selectedPartOfSpeech: selectedPOS)
|
||||
}
|
||||
.onChange(of: tokiInput) { newValue in
|
||||
tokiDictViewModel.filterDictionary(newValue)
|
||||
tokiDictViewModel.filterDictionaryEnglishMode(newValue)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -39,6 +39,6 @@ struct DictionaryView: View {
|
||||
struct DictionaryView_Previews: PreviewProvider {
|
||||
|
||||
static var previews: some View {
|
||||
DictionaryView(selectedPartOfSpeech: "n").previewLayout(.sizeThatFits).environment(\.managedObjectContext, PersistenceController.preview.container.viewContext)
|
||||
DictionaryView().previewLayout(.sizeThatFits).environment(\.managedObjectContext, PersistenceController.preview.container.viewContext)
|
||||
}
|
||||
}
|
||||
|
@@ -15,14 +15,14 @@ struct TranslatorView: View {
|
||||
|
||||
var body: some View {
|
||||
VStack {
|
||||
Button(action: changeTranslationDirection) {
|
||||
// TODO: This needs to actually switch how the lookup happens
|
||||
if translateToTokiPona == true {
|
||||
LanguageDirectionView(from: "English", to: "Toki Pona", fromColor: .blue, toColor: .cyan)
|
||||
} else {
|
||||
LanguageDirectionView(from: "Toki Pona", to: "English", fromColor: .cyan, toColor: .blue)
|
||||
}
|
||||
}
|
||||
// Button(action: changeTranslationDirection) {
|
||||
// #warning("This needs to actually switch how the lookup happens")
|
||||
// if translateToTokiPona == true {
|
||||
// LanguageDirectionView(from: "English", to: "Toki Pona", fromColor: .blue, toColor: .cyan)
|
||||
// } else {
|
||||
// LanguageDirectionView(from: "Toki Pona", to: "English", fromColor: .cyan, toColor: .blue)
|
||||
// }
|
||||
// }
|
||||
TextField("Enter Toki Pona Word or Phrase", text: $tokiInput)
|
||||
.multilineTextAlignment(.center)
|
||||
.textInputAutocapitalization(.never)
|
||||
|
Reference in New Issue
Block a user