Part of speech highlighting when tapped from dictionary list

This commit is contained in:
Avery Pace committed 2021-11-04 14:10:22 -04:00
1 parent c7f50a4d3a
commit d5e3d29225
6 files changed
+108 -31

No files matched your search

@@ -0,0 +1,25 @@
//
// TokiDictionaryViewModel.swift
// Toki Trainer
//
// Created by Avery Ada Pace on 11/4/21.
//
import Foundation
class TokiDictionaryViewModel: ObservableObject
{
let jsonLoader: TokiJSONLoader = TokiJSONLoader()
@Published var dictionary: [TokiDictEntry] = []
@Published var partsOfSpeech: [TokiPartOfSpeech] = []
init() {
if let safeDictionary = jsonLoader.loadDictionary() {
dictionary = safeDictionary
}
if let safePartsOfSpeech = jsonLoader.loadPOS() {
partsOfSpeech = safePartsOfSpeech
}
}
}